希望将弹出框的位置改变带actionbar下面 不要直接换个theme的方法 希望由 style 加些属性改变
android 对话框弹出位置和透明度的设置
在android中我们经常会用AlertDialog来显示对话框。通过这个对话框是显示在屏幕中心的。但在某些程序中,要求对话框可以显 示在不同的位置。例如,屏幕的上方或下方。要实现这种效果。就需要获得对话框的Window对象,获得这个Window对象有多种方法。最容易的就是直接 通过AlertDialog类的getWindow方法来获得Window对象。
?
AlertDialog dialog = new AlertDialog.Builder(this).setTitle("title")
.setMessage("message").create();
Window window = alertDialog.getWindow();
window.setGravity(Gravity.TOP); //window.setGravity(Gravity.BOTTOM);
alertDialog.show();
具体可参考