I've got an app which uses <item name="android:windowActionBarOverlay">true</item>
For some reason, this causes the ActionBar to be at the end of the Accessibility focus list, even though it occurs first on the page, and appears to have a higher "z-index" (it's drawn on top of the TextView).
I created a sample testapp (see screenshot) and when I ask TalkBack to "Read From Top", it starts with "Hello World, Hello World, Hello World, Hello World" instead of "Action Bar Order".
The test project is a simple 1-fragment activity. My xml files are below, the Activity is boilerplate from the Android Studio wizard.
activity_my.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyActivity"
tools:ignore="MergeRootFrame" />
fragment_my.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MyActivity$PlaceholderFragment">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Action Bar Order</string>
<string name="hello_world">Hello world! \n Hello world! \n Hello World! \n Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
Can anyone tell me how I can get the ActionBar to consistently get focus first in this scenario? I tried to add marginTop to see if that would help, making the TextView actually appear on the screen at a lower position than the ActionBar, but that didn't help either.
Because I had exhausted my options, and @alanv (who definitely knows his stuff about android accessibility) confirmed that there is no good app-side workaround, I ended up changing the Theme when in accessibility mode to use <item name="android:windowActionBarOverlay">false</item>. This obviously has other complications - the most obvious is that there's less screen real estate, but it's the best I could do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With