我有一个持久化的底片,如bottom_sheet_persistent.xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottomSheet"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:behavior_hideable="false"
    app:behavior_peekHeight="80dp"
    app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="230dp"
        android:background="#2196F3"
        app:layout_constraintTop_toTopOf="parent" >
        <TextView
            android:text="Text in Bottom Sheet"
            android:layout_width="match_parent"
            android:textSize="24sp"
            android:layout_height="wrap_content"/>
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>使用底表的活动是
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E7E7E7"
            app:layout_constraintTop_toTopOf="parent">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="bottom"
                android:paddingBottom="200dp"
                app:layout_constraintTop_toTopOf="parent" >
    
                <TextView
                    android:text="Text in Activity"
                    android:textSize="24sp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
            </LinearLayout>
    
            <include
                android:id="@+id/bottomSheet"
                layout="@layout/bottom_sheet_persistent" />
        </androidx.coordinatorlayout.widget.CoordinatorLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>当我打开可访问性的对讲机并展开底部工作表时,活动中的文本(将被瓶装工作表的文本视图重叠)获得焦点。我如何才能把焦点放在底部(似乎是如此明显)。我试着使底部页可点击,但在这种情况下,整个底纸得到的焦点,而不是个别的项目。
任何帮助或建议!
发布于 2022-03-10 22:58:00
底部工作表布局的父视图如下所示
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottomSheet"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:behavior_hideable="false"
    app:behavior_peekHeight="80dp"
    android:focusable="true"
    android:importantForAccessibility="no"
    android:clickable="true"
    app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">发布于 2022-04-08 06:22:33
我也遇到了同样的问题,并将其显式地调用了performAccessibilityAction()。在下面的床单上试试这个。
yourView.performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS,null)发布于 2022-09-15 15:20:34
BottomSheetBehaviour.setUpdateImportantForAccessibilityOnSiblings(Boolean)就是你要找的东西。
当您将其设置为true时,它基本上告诉辅助功能服务在展开时忽略BottomSheet下的所有视图,允许TalkBack只聚焦包含在底部工作表中的视图。
https://stackoverflow.com/questions/71403470
复制相似问题