I'm interested in this question aswell, and how you can set the height
of each row for that matter, would be nice not to have to reimplement
the whole GridView.

Regards,

//Erik

On Dec 9 2008, 10:42 am, Andriy Zakharchuk
<andriy.zakharc...@gmail.com> wrote:
> Hello Xavier,
>
> what I'm trying to do is to get android.widget.GridViewstretched to
> screen.
>
> private LinearLayout panelContent = null;
> privateGridViewgridViews = null;
>
> ...
>
> panelContent = new LinearLayout(this);
>
> // Custom adapter implementation
> ListAdapterImpl adapter = new ListAdapterImpl();
>
> gridViews = newGridView(this);
> gridViews.setAdapter(adapter);
> gridViews.setNumColumns(2);
>
> LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
>             LinearLayout.LayoutParams.FILL_PARENT,
>             LinearLayout.LayoutParams.FILL_PARENT,
>             1
> );
> panelContent.addView(gridViews, lp);
> setContentView(panelContent);
>
> In this caseGridViewcovers all the screen, however, grid item views
> take as much space as they need.
>
> What I'm trying to get. Lets imagine the screen is in the portrait
> mode, screen size  (to make it simpler - grid view height) is 480
> pixels.GridViewhas two colums. Then:
> - when I have 1 or 2 elements (1 row) row height should be 480 pixels.
> - when I have 3 or 4 elements (2 rows) row height should be 240
> pixels.
> - when I have 5 or 6 elements (3 rows) row height should be 160
> pixels.
> - and so on.
>
> I can not control grid view item height with ListAdapter.getView(). I
> looked into AbsListView.generateLayoutParams(), but it work with
> AbsListViewLayout params which doesn't support smth like weight. So I
> was not able to redistribute extra space(height) between grid view
> items.
>
> On Dec 1, 9:46 pm, "Xavier Mathews" <xavieruni...@gmail.com> wrote:
>
> > Where are you trying to stretch this? I believe you can if you are talking
> > about android i can go see for you.
>
> > Xavier A. Mathews
> > Student/Browser Specialist/Developer/Web-Master
> > Google Group Client Based Tech Support Specialist
> > Hazel Crest Illinois
> > xavieruni...@gmail.com¥xavieruni...@hotmail.com¥truestar...@yahoo.com
> > "Fear of a name, only increases fear of the thing itself."
>
> > On Mon, Dec 1, 2008 at 8:47 AM, Andriy Zakharchuk <
>
> > andriy.zakharc...@gmail.com> wrote:
>
> > > Hello all,
>
> > > I have a question about grid view: is there any chance to stretch
> > >GridViewvertically. What I'm trying to do is to create a screen with
> > > a limited number of items (6). I need exactly 2 columns and 3 rows (or
> > > 3x2 in landscape mode) to fill all the screen.
>
> > > In a grid view I can control columns number, and columns stretching
> > > mode, but not rows. I'm looking into overriding
> > > AbsListView.generateLayoutParams() method, but want to ask first.
> > > Probably, there is some simpler way available.
>
> > > Thank you in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to