gpt4 book ai didi

android - 在 FrameLayout 中移动焦点

转载 作者:太空宇宙 更新时间:2023-11-03 11:26:10 25 4
gpt4 key购买 nike

目前,我们有一个包含 FrameLayout 的 DrawerLayout 和一个带有页脚信息的 LinearLayout。 FrameLayout 包含内容 fragment 。在可访问性模式下,页脚在框架之前获得焦点。我们希望框架的内容首先获得焦点。但是,包含页脚信息的 LinearLayout 总是在 FrameLayout 的内容之前获得焦点。

我们尝试添加 <requestFocus />使用和不使用 :focusable 的 FrameLayout 和 FrameLayout 的内容和 :focusableInTouchMode设置为真,<setFocusForward>到 FrameLayout,并调用 requestFocus()在内容 fragment 中。 requestFocus()返回 true,但它似乎没有保持焦点。

布局.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NavigationControllerActivity" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="vertical" >

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFFFFF" >
</FrameLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="vertical" >

<TextView/>

</LinearLayout>

有什么方法可以让 FrameLayout 的内容在其下方的 LinearLayout 之前获得焦点?

最佳答案

设置

android:importantForAccessibility = "true"

在Framelayout内容中

关于android - 在 FrameLayout 中移动焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26978583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com