How to set Android dialog's size to match the dialog's layout size?
android, dialog
Solution
You have to set to dialog the option not to have a title.
So add this: `dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);`
Hope this helps!
Problem
I have this xml which defines my dialog: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:text="test" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> ``` And this is my dialog: ``` OverlayItem item = mapOverlays.get(index); Dialog dialog = new Dialog(context); dialog.setContentView(R.layout.map_menu); dialog.setCanceledOnTouchOutside(true); dialog.show(); ``` For some reason my dialog is bigger then my "test" textview (much higher). I want my dialog to be exactly as my text. how can i do that ?