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

早过忘川 提交于 2019-11-28 19:32:00
Mark Allison

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!