【发布时间】:2013-08-21 08:10:57
【问题描述】:
我需要对话框来填充屏幕,除了顶部和底部的一些空间。
我一直在寻找解决方案,但找不到可能是因为我在onClickListener 中声明了它。
谁能给个解决办法?
活动代码:
sort.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AlertDialog.Builder sort = new AlertDialog.Builder(HomeScreen.this);
// Get the layout inflater
LayoutInflater inflater = HomeScreen.this.getLayoutInflater();
View sortView = inflater.inflate(R.layout.sort_layout, null);
sort.setView(sortView);
sort.create().show();
}
});
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="50dp"
android:layout_marginTop="50dp"
android:background="@color/white"
android:orientation="vertical" android:layout_gravity="center">
+ some more stuff here I dont think it's relevant
</LinearLayout>
【问题讨论】:
-
已经尝试过 getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT) 但它什么也没做,它说它已被弃用。
-
你已经为那个做了一个自定义样式...
-
我会在哪里应用它?
标签: android android-dialog android-fullscreen