私の WebView には何も表示されません。それはただ空です。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<!-- <LinearLayout
android:id="@+id/tableRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/buttonAccept"
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_accept" />
<Button
android:id="@+id/buttonDeny"
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/button_deny" />
</LinearLayout> -->
</LinearLayout>
これはアクティビティです:
public class TermsOfUseDialogActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.terms_menu_dialog);
WebView webview = (WebView) findViewById(R.id.webview);
// WebView webview = new WebView(this);
// setContentView(webview);
String htmlCode = "<html><body>WebView Test<br /><br />New Line Test</body></html>";
// webview.loadDataWithBaseURL(null, htmlCode, "text/html", "UTF-8", null);
// webview.clearView();
webview.loadData(htmlCode, "text/html", "UTF-8");
// webview.reload();
// webview.loadUrl("http://www.google.at");
}
}
ご覧のとおり、いくつかのコードをコメントアウトしました。この部分を除いて、これらの試行が機能した場合はありません...
WebView webview = new WebView(this);
setContentView(webview);
この場合、コンテンツは表示されますが、上記の XML に示されているボタンも使用する必要があるため、これを使用できません。これがコンテンツを表示しない理由はありますか?
(インターネット権限は AndroidManifest で設定されます)