Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android layout 可访问性旅行社在不使用前';我不能用对讲机_Android Layout_Talkback - Fatal编程技术网

Android layout 可访问性旅行社在不使用前';我不能用对讲机

Android layout 可访问性旅行社在不使用前';我不能用对讲机,android-layout,talkback,Android Layout,Talkback,我有一个带有物品列表的回收器视图。这就是它的样子: 我需要添加对讲支持。问题在于聚焦内部回收项目视图的顺序 这应该是正确的顺序: 1. Name of first member (A) 2. Amount under first member's name (2469...) 3. Name of second member (B) 4. Amount under second member's name (2469...) 问题在于默认焦点顺序不同: 1) Name of

我有一个带有物品列表的回收器视图。这就是它的样子:

我需要添加对讲支持。问题在于聚焦内部回收项目视图的顺序

这应该是正确的顺序:

 1. Name of first member (A)
 2. Amount under first member's name (2469...)
 3. Name of second member (B)
 4. Amount under second member's name (2469...)
问题在于默认焦点顺序不同:

    1) Name of the first member 
    2) Name of the second member 
    3) Amount under the first member
    4) Amount under the second member
解决办法应该很简单。有一个参数android:accessibilityTraversalBefore=“@+id/someID”,用于更改焦点顺序。我在我的应用程序的其他视图中使用这个参数没有问题-它工作得很好。然而,当我在这里使用它时,它根本没有任何效果-视图仍然以默认顺序聚焦。 让我们来看看回收商项目布局:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="56dp">

    <android.support.constraint.Guideline
        android:id="@+id/vGuideline"
        style="@style/Layout.Guideline"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.5"/>

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/vFirstAvatar"
        style="@style/Image.AvatarMember"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:src="@drawable/avatar_multiple" />

    <!-- Ellipsized because it can overlay the second member. -->
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/vFirstName"
        style="@style/TextView.NameEllipsized"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="11dp"
        android:layout_marginEnd="8dp"
        android:importantForAccessibility="yes"
        android:layout_marginRight="8dp"
        android:accessibilityTraversalBefore="@+id/vFirstAmount"
        android:textAppearance="@style/ListPrimaryTiny"
        app:layout_constraintLeft_toRightOf="@+id/vFirstAvatar"
        app:layout_constraintRight_toLeftOf="@+id/vGuideline"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Suzan" />

    <!-- Ellipsized because it can overlay the second member. -->
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/vFirstAmount"
        style="@style/TextView.NameEllipsized"
        android:layout_marginTop="2dp"
        android:accessibilityTraversalBefore="@+id/vSecondName"
        android:textAppearance="@style/ListSecondary"
        android:importantForAccessibility="yes"
        app:layout_constraintLeft_toLeftOf="@+id/vFirstName"
        app:layout_constraintRight_toRightOf="@id/vGuideline"
        app:layout_constraintTop_toBottomOf="@+id/vFirstName"
        tools:text="$22" />

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/vSecondAvatar"
        style="@style/Image.Avatar"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:src="@drawable/avatar_multiple" />

    <!-- Ellipsized because it can overlay first member. -->
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/vSecondName"
        style="@style/TextView.NameEllipsized"
        android:layout_marginEnd="16dp"
        android:layout_marginRight="16dp"
        android:importantForAccessibility="yes"
        android:accessibilityTraversalBefore="@+id/vSecondAmount"
        android:layout_marginTop="11dp"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:gravity="end"
        android:textAppearance="@style/ListPrimaryTiny"
        app:layout_constraintLeft_toLeftOf="@+id/vGuideline"
        app:layout_constraintRight_toLeftOf="@+id/vSecondAvatar"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Dave" />

    <!-- Ellipsized because it can overlay the first member. -->
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/vSecondAmount"
        style="@style/TextView.NameEllipsized"
        android:layout_marginTop="2dp"
        android:importantForAccessibility="yes"
        android:layout_marginLeft="8dp"
        android:layout_marginStart="8dp"
        android:gravity="end"
        android:textAppearance="@style/ListSecondary"
        app:layout_constraintRight_toRightOf="@+id/vSecondName"
        app:layout_constraintLeft_toLeftOf="@id/vGuideline"
        app:layout_constraintTop_toBottomOf="@+id/vSecondName"
        tools:text="$8" />

</android.support.constraint.ConstraintLayout>

你知道Talkback完全忽略的原因是什么吗 AccessibilityTraversalBefore属性

如果您查看“对讲”项目中的,您可以看到对讲实际上尊重此属性。我对此表示歉意,但我没有时间为此设置测试并进行确认,但我猜在XML中设置它是行不通的。很可能recycler视图在运行时覆盖了XML属性

在渲染完所有视图后,尝试在代码中执行此操作。可能还涉及一些比赛条件!我真的不知道你要用什么回调才能可靠地实现这一点。我以后可能会进一步调查