use
android:layout_width="match_parent"
android:layout_height="match_parent"
in LinearLayout
final Dialog dialog = new Dialog(MainAppActivity.this, R.style.PopupDialog);
dialog.setContentView(R.layout.popup);
dialog.setCancelable(true);
Button cancelButton = (Button)dialog.findViewById(R.id.close);
cancelButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
dialog.cancel();
}
});
dialog.show();
Put this in res/values/styles.xml
<style name="PopupDialog" parent="@android:style/Theme.Translucent.NoTitleBar"></style>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…