普通方法弹出alert后,取消标题还会有小部分高度,这个倒会好些:
先定义一个样式 res/values/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FullHeightDialog"
parent="android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
<resources>
<style name="FullHeightDialog"
parent="android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
弹出alert时稍微修改一下:
Dialog dialog = new Dialog(this, R.style.FullHeightDialog);
dialog.setContentView(R.layout.article_comment);
dialog.show();
dialog.setContentView(R.layout.article_comment);
dialog.show();
你可以弹出一个窗体,也和alert类似的效果。
首先修改一下窗体的属性:
修改AndroidManifest.xml 文件:
<activity android:name=".Test"
android:theme="@android:style/Theme.Dialog">
</activity>
android:theme="@android:style/Theme.Dialog">
</activity>
这是声明样式,下面是打开activity后,oncreate时加点参数:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
this.setContentView(R.layout.article_comment);
}
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
this.setContentView(R.layout.article_comment);
}