質問

I've overridden the default blue text selection handles in most of my app by adding these items to the app theme and adding the appropriate 9 patch drawables:

<item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>

However, this doesn't apply to text selection in a WebView (the blue handles are still there). How can I override the corresponding items in the WebView style?

正しい解決策はありません

他のヒント

WebView seems to be referencing the system resources (e.g. android.R.attr.textSelectHandleLeft etc) directly for drawing the handles on its own: http://src.chromium.org/svn/trunk/src/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java

So, I'd say there's no way to re-style them.

Create your own theme resources and reference them in your Android Manifest.

create your own theme and put it inside res/values

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyTheme">
        <item name="android:textSelectHandleLeft"> 
            @drawable/my_own_handle
        </item>
        <item name="android:textSelectHandleRight">
            @drawable/my_own_handle
        </item>
     </style>
 </resources>

refer your own in AndroidManifest.xml.

<application android:theme="@style/MyTheme" >

PS: Referred from crbug: Overriding Selection Controls in Web view

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top