Human
Human

Reputation: 10825

GridView as child of FrameLayout with layout_weight

How to make the HxW of the GridView same as the HxW of the parent view (FrameLayout) ?

enter image description here

xml :

<FrameLayout
            android:id="@+id/frame_menu"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="8">

            <GridView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/gridView"
                android:numColumns="2"
                android:layout_gravity="center" />
        </FrameLayout>

Upvotes: 0

Views: 310

Answers (1)

Elltz
Elltz

Reputation: 10869

set Gravity to android:gravity="fill_horizontal" or android:gravity="fill"; and also use android:stretchMode="columnWidth"..

if it fails try to use auto_fit

Upvotes: 1

Related Questions