2017-01-09 5 views
-1

enter image description hereView at the bottom of my activity is hide popupwindowを立ち往生は、WebビューにURLを渡すことは、これは私がこれと同じ活動に別のレイアウトを膨張し、表示するためにpopupviewを使用しています、私のJavaコードである

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 
<android.support.v7.widget.Toolbar 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary" 
    android:id="@+id/toolbar" 
    app:elevation="3dp" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    app:title="View"> 
    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/cancel1" 
     android:layout_gravity="end" 
     android:layout_marginRight="10dp" 
     android:id="@+id/cancel"/> 
    </android.support.v7.widget.Toolbar> 
<WebView 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:id="@+id/main"/> 
</LinearLayout> 

私は私の活動を下にスクロールするように動けなくなると一番下にそのツールバーのショーの後にその点滅を開始します。

答えて

0

あなたはこのようなあなたのレイアウトを変更して再試行してくださいすることができます

<WebView 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:layout_width="match_parent" 
    android:id="@+id/main"/> 
+0

ご提案いただきありがとうございますが、私にとってはうまく機能しません。 –

0

をあなたはポップアップウィンドウの代わりに、ダイアログを使用する必要があります。

final Dialog d=new Dialog(this,R.style.fullscreendialog); 
     d.setContentView(R.layout.webview); 
     WebView web = (WebView) d.findViewById(R.id.main); 
     ImageView cancel = (ImageView) d.findViewById(R.id.cancel); 
     cancel.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 
       d.dismiss(); 
      } 
     }); 
     web.getSettings().setJavaScriptEnabled(true); 
     //web.getSettings().setPluginState(WebSettings.PluginState.ON); 
     web.getSettings().setAllowFileAccess(true); 
     //Toast.makeText(TeacherHome.this,"https://docs.google.com/gview?embedded=true&url="+url,Toast.LENGTH_LONG).show(); 
     web.loadUrl("http://www.javatpoint.com"; 
     d.show(); 
     d.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 

それだけで親を削除シュリンク作るTheme.dialogの親として、あなたのスタイルに

<style name=fullscreendialog/> 

理由の背後に追加するテーマダイアログ継承これを追加...これは、よりカスタマイズ可能で、実装は非常に簡単です。テーマは魅力のように機能します。

+0

ありがとうAbhishekそれも動作し、ブラウザではなくwebview上のすべてのウィンドウを開くためにこの行を追加します。 web.setWebViewClient(新しいWebViewClient()); –

関連する問題

 関連する問題