Android WebView no selection color - android

In my application I have a webView that contains the FB like button.
JS is enabled to get redirected.
Now my problem is, I want to get rid of the orange selector.
I know this can be done by css, but where do I put my Css file , and how to apply it to my webView?
or is there a other way to accomplish this ?

found it!
webView.setFocusable(false);

Related

How to get WebView to ignore css

I am trying to load a local HTML page in an Android Webview. This page contains some layouting using CSS. But I also noticed that the Webview has a setBackgroundColor() method in which you can set a background color. however this does not work when the CSS file also set a background color.
Does anyone know how to make the Android Webview to ignore these CSS style when I set my own background color?
What you could do is add style to your page with javascript:
webview.loadUrl("javascript:document.body.style.background = color;");
Call this after you have loaded your url or html.
PS I think if you ignored the CSS you would the get the default white background even if you set setBackGroundColor()
setBackGroundColor is a method that all Views have, that's the only reason WebView has it imo.

Facebook style button in Android (selector.xml)

Right now, I'm coding an OAuth/Facebook login in my app, and I'd like to add a native button (not a ImageButton with some kind of image on it as src/bg) with the Facebook color and font styles. Does anyone knows the combination of settings to create a selector xml file that appears like facebook styles?
I know that it sounds to be lazy from my part... but I'm tired on trying to reach the correct settings by experimenting through empirical trial-and-error. So, I hope that someone already knows this settings. It should be something like the bellow image:
Thanks in advance!

WebView shows transparent color while navigating back to Webview from next screen on ICS (Android 4)

In Android 4, CSS is ignored while navigating back to Webview from next Screen. For first time this works fine.
This behavior is only for Transparent color. Other color works fine.
WebView webView = new WebView(activity);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL) ;
/**
* Default color of webview must be transparent
*/
webView.setBackgroundColor(Color.TRANSPARENT);
There are multiple suggestion for you as I am not an android guy :) ....
1. Hope this could help you :
mWebView.setBackgroundColor(0x00000000);
Found at : Android WebView style background-color:transparent ignored on android 2.2
2. Also try setting Alpha property to 1.
3. This must solve your problem. Try setting setBackgroundResource(int) - A drawable to use as the background. Found Link : http://developer.android.com/reference/android/webkit/WebView.html
4. Finally If above answers doesnt help then I think below link could help you. But this could be a bug in Android 4.
See the following link : http://www.iriphon.com/2011/04/27/the-android-transparent-webview-bug/
http://code.google.com/p/android/issues/detail?id=19510
After many tries found it was device issue!!.. :(

Android: How to load a page into a WebView and then apply some custom css to it?

I need to load a page into a webview and then apply some custom css to it. This page is not under my control, so I can't simply add a CSS include or inline CSS within the page itself.
Right now I'm just doing an HTTP get request, putting the contents into a String, prepending the string with my custom css (in style tags), and finally doing a loadDataWithBaseURL() on the string.
Is there a more elegant/efficient solution?
Thanks!
Well using what is available in the Webview, you have probably done the best that could be done.
However, if you really want to do it elegantly, get the source codes of WebView and all the classes it needs. Alter them to ultimately add the function WebView.setCSS() (for example)... It is doable but it needs some time.
you can just try WebView.reload() just like :
if(first_loading){
w.loadUrl(DisplayActiviyParam.sd_html);
first_loading = false;
}else{
w.reload();
}
,what you need do is tu change your css file contents. Good lucky!

Arabic Font in android webview?

We have site urls having arabic language we want to display as it is in android webview but it is not showing as correctly it is showing in reverse. Can you help me????
There is a simple solution of it. As correct order letters display in reverse order. Why not we write reverse letters?
This link will help https://stackoverflow.com/a/13562693/1547539
Just set the encoding :
YourWebView.loadData(YourContentHtml, "text/html; charset=UTF-8", null);
I fully understand your issue, you mean:
[أحمد] Would show as [دمحا]
I am afraid this is not possible, I have seen some post around all confirm that can't be done in the mean time.
Android has the ability to use custom TTFs in views (though it's kind of a kludge, example on how to use custom typefaces in the API Demos), but I'm not sure how to extend this to WebView, or whether it's even possible. custom font with Webview
Also see: font face of Webview in Android?

Categories

Resources