设置android.webkit.WebTextView类的文本颜色? [英] Set the textcolor of android.webkit.WebTextView class?

查看:317
本文介绍了设置android.webkit.WebTextView类的文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有形式的调查类型吐出后,用户presses提交的响应。这是使用的WebView客户端,所以我可以很容易地修改CSS之前我重写的URL。然而,在pressing提交,风格有一个黑色的字体​​(和其他有害的东西)。有没有办法来改变WebTextView的文本颜色?

最终,这将是理想的替代,但它看起来像我不能:

  WebTextView(上下文的背景下,web视图网页视图,诠释autoFillQueryId){超(背景下,空,com.android.internal.R.attr.webTextViewStyle);
     mWebView = web视图;
     mMaxLength = -1;
     setAutoFillable(autoFillQueryId);
     //开启子像素的文字,并关闭字距,所以它更好的匹配
     // WebKit中的文本。
     TextPaint涂料= getPaint();
     INT标志= paint.getFlags()及〜Paint.DEV_KERN_TEXT_FLAG
             | Paint.SUBPIXEL_TEXT_FLAG | Paint.DITHER_FLAG;
     paint.setFlags(标志);     //文字颜色设置​​为黑色,无论主题。这可确保
     //使用嵌入式网页视图的其他应用程序将正常
     //显示密码文本框的文本。
     setTextColor(?DebugFlags.DRAW_WEBTEXTVIEW Color.RED:Color.BLACK);


解决方案

  

有没有办法来改变WebTextView的文本颜色?


有没有 WebTextView 在Android SDK,所以,作为一个结果,你不能修改的。


  

这是使用的WebView客户端,所以我可以很容易地修改CSS之前我重写的URL。


这听起来像你的问题是,CSS应该没错本来,无论是对您提交此表单显示页面和你算账显示页面。 IOW,解决的办法是从HTML / CSS / JS的角度来看,你(presumably)控制。

得到它的权利

I have a survey type of form that spits out a response after the user presses submit. This is using the webview client so I can easily modify the CSS before I override the URL. However, After pressing submit, the style has a black font (and other unwanted things). Is there a way to change the text color of the WebTextView?

Ultimately, it would be ideal to override this, but it looks like I can't:

WebTextView(Context context, WebView webView, int autoFillQueryId) {         super(context, null, com.android.internal.R.attr.webTextViewStyle);
     mWebView = webView;
     mMaxLength = -1;
     setAutoFillable(autoFillQueryId);
     // Turn on subpixel text, and turn off kerning, so it better matches
     // the text in webkit.
     TextPaint paint = getPaint();
     int flags = paint.getFlags() & ~Paint.DEV_KERN_TEXT_FLAG
             | Paint.SUBPIXEL_TEXT_FLAG | Paint.DITHER_FLAG;
     paint.setFlags(flags);

     // Set the text color to black, regardless of the theme.  This ensures
     // that other applications that use embedded WebViews will properly
     // display the text in password textfields.
     setTextColor(DebugFlags.DRAW_WEBTEXTVIEW ? Color.RED : Color.BLACK);

解决方案

Is there a way to change the text color of the WebTextView?

There is no WebTextView in the Android SDK, so, as a result, you cannot modify one.

This is using the webview client so I can easily modify the CSS before I override the URL.

It sounds like your problem is that the CSS should be right originally, both for the page you display before submitting this form and the page you display afterwards. IOW, the solution is to get it right from an HTML/CSS/JS standpoint, which you (presumably) control.

这篇关于设置android.webkit.WebTextView类的文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆