Reputation: 2637
My Dialog layout contains:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
The dialog still appears as small as its contents.
I had to do:
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
... within the the onCreateDialog callback in order for it to fill the screen.
I can't find any reference to this behaviour on the google dev site.
Upvotes: 1
Views: 561
Reputation: 2637
Answering my own question after much experimenting. Issue has to do with the usage of a Dialog class as opposed to a AlertDialog.
In short, it didn't work because I didn't use the right tools and approach. Solution was to either: continue using a Dialog class but then force it by using d.getWindow() and modifying the dimensions from there OR to use an AlertDialog and inflating the layout as such:
LayoutInflater inflater = (LayoutInflater) getLayoutInflater();
View layout = inflater.inflate(R.layout.about, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
This linked helped a lot: Why does LayoutInflater ignore the layout_width and layout_height layout parameters I've specified?
Upvotes: 1