敬酒辞中的Android WebView

敬酒辞中的Android WebView,android,webview,toast,Android,Webview,Toast,我正在尝试将一个网络视图放入toast中,或者将网络视图显示在屏幕的一小部分上 以下是xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RelativeLay

我正在尝试将一个网络视图放入toast中,或者将网络视图显示在屏幕的一小部分上

以下是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>
提前谢谢:)

试试这个

  LayoutInflater inflater = getLayoutInflater();     
    View layout = inflater.inflate(R.layout.toast_equation_menu,(ViewGroup)findViewById(R.id.toast_layout_root));
从充气机视图获取网络视图

首先将url添加到WebView

   WebView webview = (WebView) layout.findViewById(R.id.webviewEquationsView);   webview.loadUrl("http://www.google.com");

    Toast toast = new Toast(getApplicationContext());
    toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.setView(layout);
    toast.show();

我使用了WebView WebView=(WebView)findViewById(R.id.webviewEquationsView);webview.loadUrl(“file:///android_asset/dsfsdf.....html"); 在导入WebView的其他类中有什么问题。。。你在哪里为网络视图设置了url。我也不知道为什么一个巨魔投票否决了我,由于我花了很多时间试图找到一些有用的东西,并且我还提供了一些代码,我找到了一个不同的解决方案。我使用了对话框功能,可以在其中显示Web视图placed@Gabi很抱歉回复太晚…您也可以使用Toast…因为您已经完成了对话,我建议您继续…不要担心,我回答得也晚了一点。对话效果很好
   WebView webview = (WebView) layout.findViewById(R.id.webviewEquationsView);   webview.loadUrl("http://www.google.com");

    Toast toast = new Toast(getApplicationContext());
    toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
    toast.setDuration(Toast.LENGTH_LONG);
    toast.setView(layout);
    toast.show();