I am using WebView
to justify text. I want to know-
Is it possible to set the text size in
layout
file? As I want different text size for different screen sizes.And also one problem is first background appears then after 2 second text display. Is it possible to display text immediately?
Size of text is 7-8 lines.
Code-
public class Main extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
String text = "<html><body>"+"<p align=\"justify\">"+getString(R.string.itext)+"</p>"+"</body></html>";
mWebView .loadData(text, "text/html", "utf-8");
mWebView .setBackgroundColor(Color.TRANSPARENT);
}
}
Xml-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/light">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"/>
</LinearLayout>