我想將WebView放入烤麪包或Webview中顯示在屏幕的一小部分上。Android WebView中的烤麪包
這裏是XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".Webview" />
<WebView
android:id="@+id/webviewEquationsView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
</LinearLayout>
和這裏就是我想放置的WebView,代碼從Android網站敬酒部分obrained了Java的部分:
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_equation_menu,(ViewGroup) findViewById(R.id.toast_layout_root));
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
謝謝提前:)
我使用web視圖網頁視圖=(web視圖)findViewById(R.id.webviewEquationsView); webview.loadUrl(「file:///android_asset/dsfsdf.....html」);在其他類中導入webview – Gabi 2013-02-25 23:22:12
問題:你在哪裏設置了webview的url。 – Pragnani 2013-02-26 04:21:25
另外我不知道爲什麼一個巨魔把我投下來,因爲我花了很多年試圖找到有用的東西,我還提供了一些代碼 – Gabi 2013-03-03 19:28:55