问题
I have an app using WebView to load page containing dropdown(Select options):<select id='num'>
<option value='10'>10</option>
<option value='20'>20</option>
<option value='50'>50</option>
WebView has getSettings().setJavaScriptEnabled(true);
When Talkback is ON, I am unable to select other options 20 or 50(10 is default selected). Talkback reads all the options(10,20,50) in the option popup but on double tapping to select an option, it just closes the popup without selecting that option.
I have tested with Nexus 4(Android 4.4.4) and Samsung S5(Android 4.4.2).
The reason I mentioned setJavaScriptEnabled settings is that on removing this setting, it works fine.
Please help.
Note: The behavior seems inconsistent. It sometimes gets selected but most of the time it does not.
On further investigating, I have found that loading my web page in the Android Chrome browser also leads to the same problem. Unchecking Enable JavaScript option from the Content settings fixes the issue.
Update: Tested my app on Android 4.0(ICS) and Android 4.1(Jelly bean). Both works fine when selecting dropdown options, irrespective of the setting Enhanced Web Accessibility or Inject Web Scripts enabled/disabled.
Also tested on Moto G Android 5.0.2. Everything works perfectly fine.
I wonder if this is an Android 4.4(KITKAT) specific issue ?
Is there any workaround for this ?
回答1:
I got exactly the same problem on a Nexus 7 with Android 4.4.4: TalkBack read all select options but no way to select them.. And like you, it works on Nexus 4 with Android 5.1.1.
To solve this, I used Crosswalk which provide a modern Chrome webview to your application instead of using each device webview.
The only flaw is that it adds around 20mb to your APK (in fact, you will have 2 APK, one for X86 and another for ARM architecture).
来源:https://stackoverflow.com/questions/29434063/android-webview-select-option-breaks-with-talkback-on