10

フルスクリーン用のポップアップウィンドウを作成したい

私は以下を使用しました:

LayoutInflater inflater = (LayoutInflater) MainActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

layoutt = inflater.inflate(R.layout.loginto,(ViewGroup) findViewById(R.id.window1));

pwindow = new PopupWindow(layoutt,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,true);

これはアクションバーをカバーしますが、フルスクリーンではありません..

また、 LayuotParams.WRAP_CONTENT は api 11+ でサポートされています。APIレベル8から機能するソリューションが必要です。

4

2 に答える 2

14

MATCH_PARENT全画面表示の場合は、代わりにパラメーターを渡す必要がありますWRAP_CONTENT

pwindow = new PopupWindow(layout,LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,true);
于 2014-06-28T12:39:49.780 に答える
1

JAVAバージョン

 View view=getLayoutInflater().inflate(R.layout.dialog_complete_pause_work,null,false);

 PopupWindow popupWindow=new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);

 popupWindow.showAtLocation(view, Gravity.CENTER,0,0);

コトリンのバージョン:

val view = layoutInflater.inflate(R.layout.your_layout, null, false)

val popupWindow = PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)

popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0)
于 2018-07-03T07:19:28.087 に答える