我最近将RatingBar视图包含在布局中,并意识到它与Talkback不兼容(它无法访问)。如何将星级评分视图考虑到对讲用户?
答案 0 :(得分:1)
这里有一些其他建议供您参考。我正在使用targetSdk = 28和androidx库。
问题1::当宣布查看组中的内容时,对讲会跳过RatingBar。
解决方案:添加带有所需公告的TextView。将其设置为0dp,这样就不会影响您的布局。看不见或消失。
<TextView
android:layout_width="0dp"
android:layout_height="0dp"
android:text="4.1 of 5 stars"/>
解决方案:显示收视率的数量,并将星号添加到contentDescription中。 (不过,以编程方式进行)
<TextView
android:id="@+id/ratingCountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="23"
android:contentDescription="4.1 of 5 stars from 23 users"/>
问题2::轻按RatingBar即可听到该值。在这种情况下,contentDescription可以使用,您可以在代码中进行设置。
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:rating="3.5"
android:stepSize="1"
android:contentDescription="4.1 of 5 stars"/>
点击并拖动RatingBar更改值似乎可行。它说20%,40%,60%。
答案 1 :(得分:0)