I took this and paste in a new android, with a few changed in other files, it didn't type anything in the applicatin, like this http://oi60.tinypic.com/2rw5lco.jpg ... does anyone know why?
package com.f.fa;
import android.os.Bundle;
import android.app.Activity;
import android.webkit.WebView;
public class PageAbus extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.abus);
String text = "<html><body style=\"text-align:justify\"> %s </body></Html>";
String data = "The power of theory lies in its ability to spare us from doing useless things. The power of theory lies in its ability to spare us from doing useless things.";
WebView webView = (WebView) findViewById(R.id.abussort);
webView.loadData(String.format(text, data), "text/html", "utf-8");
}
}
EDIT Here is the xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#1d72c3"
android:gravity="center" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical"
android:textStyle="italic" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<WebView
android:id="@+id/abussort"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:textColor="#ffffff"
android:textSize="21sp"
android:textStyle="italic" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>
You should add this permission in manifest file:
<uses-permission android:name="android.permission.INTERNET" />
Check this link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.