0

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);
kevinl
  • 4,194
  • 6
  • 37
  • 55

1 Answers1

1

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • thanks for your answer. I did not end up doing anything with css since I didn't have access, but I just ended up serializing the form html data and using native android controls with an EditText and a Button to submit the POST data as a service. – kevinl Feb 27 '13 at 22:12