Horizontal scroll in GridView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Horizontal scroll in GridView

Postby umair » Thu Feb 26, 2009 1:20 pm

Hi!

I am developing a view in which i want to display some thumbnail images and one-line information about them.
I've user to BaseAdapter to achieve my task and it's working well.

The number of images I get to display is dynamic and can be anything > 1. The items display in a grid of 3 columns and multiple number of rows. When the size of items is larger, a vertical scroll bar is attached and I can scroll through all the items.

Now what I want is that I can somehow manage to fix the number of rows so that number of columns becomes dynamic. So the scrolling would become Horizontal rather than vertical. What I've learn so far is that horizontal scroll bar will appear only if the number of columns is not adjustable within the width of the screen.

I want a horizontal scroll either by
1- horizontal scroll bar
2- OR horizontal slide

Is that achievable?

Thanks for your comments! :)
Muhammad Umair
User avatar
umair
Developer
Developer
 
Posts: 28
Joined: Thu Feb 26, 2009 1:00 pm
Location: Lahore, Pakistan

Top

Re: Horizontal scroll in GridView

Postby jagtap.jj1 » Thu Feb 26, 2009 1:43 pm

U can num of columns dynamically from code by using : setNumColumns(int)
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby umair » Thu Feb 26, 2009 1:47 pm

and can i make number of rows fixed?
Muhammad Umair
User avatar
umair
Developer
Developer
 
Posts: 28
Joined: Thu Feb 26, 2009 1:00 pm
Location: Lahore, Pakistan

Postby jagtap.jj1 » Thu Feb 26, 2009 2:15 pm

there is no any provision to fix the num of rows for gridview in android

if there r 15 items, if u set num of columns 4; then 3 row will contain 4 items while last one will be having just 3items

there also default value for num columns "auto_fit",

refer this http://code.google.com/android/referenc ... dView.html
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests