Hello Xavier, what I'm trying to do is to get android.widget.GridView stretched to screen.
private LinearLayout panelContent = null; private GridView gridViews = null; ... panelContent = new LinearLayout(this); // Custom adapter implementation ListAdapterImpl adapter = new ListAdapterImpl(); gridViews = new GridView(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 case GridView covers 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. GridView has 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" <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED]@[EMAIL PROTECTED] > "Fear of a name, only increases fear of the thing itself." > > On Mon, Dec 1, 2008 at 8:47 AM, Andriy Zakharchuk < > > [EMAIL PROTECTED]> wrote: > > > Hello all, > > > I have a question about grid view: is there any chance to stretch > > GridView vertically. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---