I need a LinearLayout to have the same width as a dialog would have it. Additionally this LinearLayout is within another GroupView (match_parent)
So:
-LinearLayout(match_parent, match_parent)
+-LinearLayout(dialog_width, wrap_content)
Any ideas how to achive this?
Edit:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<!-- This is the one which should be in dialog width -->
<LinearLayout
android:paddingTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:text="Hi there"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end">
<Button
android:id="@android:id/button1"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:string/ok"/>
<Button
android:id="@android:id/button2"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:string/cancel"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
May be also important to say: It should also change size on tablet/rotation etc.