Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theme.Dialog creates too small screen

Tags:

android

themes

I have an activity with ListView that has:

android:theme="@android:style/Theme.Dialog"

in Manifest. When I open it and when it has only one line in ListView, the window that opens is very small. How do I make the window take the whole screen?

like image 842
OkyDokyman Avatar asked Dec 21 '22 14:12

OkyDokyman


1 Answers

Use this in your onCreate method of the Activity to make it full screen.

   @Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    setContentView(R.layout.myxml);

    LayoutParams params = getWindow().getAttributes(); 
            params.height = LayoutParams.MATCH_PARENT;
            params.width  = LayoutParams.MATCH_PARENT;
           getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);
   } 
like image 89
PravinCG Avatar answered Jan 05 '23 10:01

PravinCG