我想将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