Android gridview adjusting to screen size

As far as i understood your question, as you have not posted any code, what you are trying to do is, you want gridview to appear on full screen.

Firstly you must be using some layout to put your gridview in. Do the following:

Make height and width of the layout to fill parent:

android:layout_width="fill_parent"
android:layout_height="fill_parent"

then, set height and width of your gridview to fill_parent as well.

Well, this is just a supposed solution that you might have been working this way. putting some code would be much better. Hope this works for you.

Update: Well the problem may lie here:

 convertView.setLayoutParams(new GridView.LayoutParams(h-45, h-39));

change to:

 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT);
 convertView.setLayoutParams(new GridView.LayoutParams(params));

Hope this works for you.


@preetha: first of all look at this example i used this and my layout did not affect irrespective of devise height and width....

http://developer.android.com/resources/tutorials/views/hello-gridview.html

set the following in xml

android:id="@+id/gridview"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:columnWidth="90dp"
    android:numColumns="auto_fit"
    android:verticalSpacing="10dp"
    android:horizontalSpacing="10dp"
    android:stretchMode="columnWidth"
    android:gravity="center"

hope this helps...