Sunday, July 29, 2012

Gallery-like single column GridView

by changing android:numColumns="1", the last exercise of "GridView" can be modified to a Gallery-like single column GridView.

Gallery-like single column GridView


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:orientation="horizontal">
    <GridView
        android:id="@+id/gridview"
        android:layout_width="130dp" 
        android:layout_height="fill_parent"
        android:columnWidth="90dp"
        android:numColumns="1"
        android:verticalSpacing="10dp"
        android:horizontalSpacing="10dp"
        android:stretchMode="columnWidth"
        android:gravity="center"
        android:background="@android:color/background_dark"/>
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:orientation="vertical"
        android:background="@android:color/background_light">
 </LinearLayout>
</LinearLayout>


1 comment:

Anonymous said...

Is it possible to display a respective large image on left side if i click on the image in the right column?