I want to display the grid view elements in only one row that means i want horizontal scrolling in grid view.Each time i want to display only 5 elements only in one row.For this give me some suggestions.Thanks in advance.
below is the my layout code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/ImageViewlarge"
android:layout_width="wrap_content" android:layout_height="wrap_content">
</ImageView>
<TextView
android:id="@+id/TextViewImageName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:editable="false">
</TextView>
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:gravity="bottom" android:layout_height="fill_parent">
<ImageView
android:id="@+id/ImageViewLeft"
android:clickable="true"
android:focusable="true"
android:layout_alignParentLeft="true"
android:src="@drawable/leftarrow" android:layout_height="50sp" android:layout_width="30sp" android:layout_gravity="bottom|left">
</ImageView>
<GridView
android:id="@+id/GridView01"
android:scrollbars="horizontal"
android:layout_height="wrap_content"
android:fadingEdge="horizontal"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:numColumns="5" android:layout_gravity="center_horizontal" android:layout_width="260sp">
</GridView>
<ImageView
android:id="@+id/ImageViewRight"
android:clickable="true"
android:focusable="true"
android:src="@drawable/rightarrow" android:layout_width="30sp" android:layout_height="50sp" android:layout_gravity="right"/>
</LinearLayout>
</LinearLayout>
in that above code now i want to remove the that 2 image view and set the horizontal scroll to that grid view elements.For this give me some suggestions,Thanks in advance
I believe the same effect could be achieved by using a
LinearLayoutwith the orientation set to horizontal. TheLinearLayoutcan be embedded in a HorizontalScrollViewThe documentation on HorizontalScrollView actually says this: