Android: Gridview cell size inconsistent -
i want achieve this
but have tried several ways adjusting layout_width, height of image view, still giving me inconsistent cell size
here code:
<android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".sta" > <android.support.v4.view.pagertitlestrip android:id="@+id/pager_title_strip" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="#33b5e5" android:paddingbottom="4dp" android:paddingtop="4dp" android:textcolor="#fff" /> </android.support.v4.view.viewpager>
main activity.xml
<gridview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/photogridview" android:layout_width="match_parent" android:layout_height="match_parent" android:columnwidth="90dp" android:numcolumns="auto_fit" android:verticalspacing="10dp" android:horizontalspacing="10dp" android:stretchmode="columnwidth" android:gravity="center"></gridview>
fragment_st_dummy.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <imageview android:id="@+id/imgv1" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="fitxy" /> <textview android:id="@+id/txtv1" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout>
customitemview.xml
my question are:
- if want have fix height description panel, possible?
- is best practice achieve gridview cell size consistency fixing image size?
unfortunately, 1 of problems gridview. if items not same size, run issues. easy solution make them fixed size. can staggeredgridview. there view opensource implementations of it, haven't tried myself can't comment on them.
Comments
Post a Comment