Reputation: 12134
I wish to show my text as in justified format, for this purpose i used webview instead of textview. Here my problem is i wish to add background image for my webview. The text content are in my string.xml
. i used the following code,
<string name="link"> <![CDATA[
<html>
<head></head>
<body style="text-align:justify;color:white;background-color:black;">
// content
</body>
</html>
]]>
</string>
in this code i set background color as black, instead of that i wish to add an .jpg or .png image. How can i modify this code. Thanks in advance.
Upvotes: 1
Views: 4395
Reputation: 35946
For that you have to set background image in xml
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/ic_launcher"
android:scrollbars="none" />
After Declaring in activity you have to set transparent background color
.
WebView webView= (WebView) findViewById(R.id.webView);
webView.setBackgroundColor(Color.TRANSPARENT);
Upvotes: 2
Reputation: 379
at frist you should put your image in res/drawable. then change your code
<body style='text-align:justify' background="file:///android_res/drawable/a1.jpg" >
Upvotes: 2