我拿了这个并粘贴了一个新的android,其他文件中有一些更改,它没有在应用程序中输入任何内容,例如http://oi60.tinypic.com/2rw5lco.jpg ...有谁知道为什么?
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 这是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>
答案 0 :(得分:0)