Henry Sou
Henry Sou

Reputation: 882

Unknown space to the right of the grid view

My xml code is:

    <GridView android:id="@+id/gridView_calendar"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:layout_weight="1" android:numColumns="5"/>

But there appear to the right of the gridView a blank. Its size seems for scroll bar. I don't know how it comes. Can anybody help me? Thanks!

Upvotes: 2

Views: 941

Answers (2)

marmor
marmor

Reputation: 28179

android:stretchMode="spacingWidthUniform"

or any other stretchMode, see: http://developer.android.com/reference/android/widget/GridView.html#attr_android:stretchMode

Upvotes: 0

Henry Sou
Henry Sou

Reputation: 882

Already solved. It's the left space for GridView.

Set screen wide is totalX. gridView node wide is deltaX, grid count is n, then the unknown space is: totalX - deltaX*n.

But is there any api to avoid this space?

Upvotes: 3

Related Questions