Input-Elements in WebViews always have the same style if highlighted on HTC Devices

前端 未结 1 934
借酒劲吻你
借酒劲吻你 2020-12-14 02:47

I\'m currently writing an app which uses an embedded WebView to display its content or to sometimes query data from the user using input forms. The input fields in these for

相关标签:
1条回答
  • 2020-12-14 03:46

    It could be related to: How can I style an HTML INPUT tag so it maintains CSS when focused on Android 2.2+?.

    Alternatively, you may be to work-around it by using a native app containing a WebView, and then apply a theme in res/values/themes.xml to your app which overrides webTextViewStyle with your own style:

    
    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="MyTheme" parent="@android:syle/Theme">
            <item name="android:webTextViewStyle">@style/MyWebTextView</item>
        </style>
    </resources>
    

    Then assign this to you app in the Manifest:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.mywebapp" android:versionCode="1" android:versionName="1">
        <uses-permission android:name="android.permission.INTERNET" />
    
        <application android:icon="@drawable/icon" android:label="@string/app_name"
            android:theme="@style/MyTheme">
            .
            .
            .
        </application>
    </manifest>
    

    Then simply load your html in to your WebView and see if the text input control has adopted the new style.

    0 讨论(0)
提交回复
热议问题