Thanks to 
this 
https://groups.google.com/d/msg/android-developers/QgN2B9CdQOo/0xdpwulIdCcJ 
from Tor Norbe I was able to figure out how to get this working.  I think 
then main issue that was causing this to not work was I wasn't using the 
right namespace which should be  xmlns:app=
"http://schemas.android.com/apk/res-auto";. 

Here is an example that now works:

<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.GridLayout xmlns:android=
"http://schemas.android.com/apk/res/android";

  xmlns:app="http://schemas.android.com/apk/res-auto";

  android:layout_width="match_parent"

  android:layout_height="match_parent"

  app:columnCount="2"

  app:useDefaultMargins="true" >

  <TextView

    app:layout_column="0"

    app:layout_gravity="left"

    app:layout_row="0"

    android:text="Label" />

  <TextView

    android:layout_width="0dp"

    app:layout_column="1"

    app:layout_gravity="fill_horizontal"

    app:layout_row="0"

    android:text="test test test test test test test test test test test 
test test test test test test test" />

</android.support.v7.widget.GridLayout>

On Thursday, April 12, 2012 9:27:53 AM UTC-6, Scott Olcott wrote:
>
> Where are you finding the documentation?  The only documentation I have 
> seen is for the GridLayout that comes with ICS.  There is no javadocs for 
> any of the classes under android.support.v7.  There is no source for them 
> in AOSP or any samples that use them that I can find anywhere.
>
> On Tuesday, April 10, 2012 2:18:02 PM UTC-6, Dave Rozsnyai wrote:
>>
>> Same here. GridLayout library hasn't been user friendly. The 
>> documentation doesn't make any note of the fact that you need to use 
>> your own namespace for columnCount if you are targeting 4.0 and now 
>> this... I would advise people to use something else unless then really 
>> need the grid. 
>>
>> On Apr 10, 9:55 am, Scott Olcott <scottolc...@gmail.com> wrote: 
>> > This is happening on Gingerbread and ICS.  When will the source for the 
>> > support library GridLayout be available in AOSP?  Currently there is no 
>> way 
>> > to debug what is happening because there is no source available. 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > On Monday, April 9, 2012 11:28:46 AM UTC-6, Romain Guy (Google) wrote: 
>> > 
>> > > You set the width of GridLayout to "wrap_content" so it will extend 
>> as 
>> > > far as its content can go. 
>> > 
>> > > On Mon, Apr 9, 2012 at 10:24 AM, Scott Olcott  wrote: 
>> > > > I am using the GridLayout that is in r7 of the support library.  I 
>> am 
>> > > having 
>> > > > an issue with text being clipped at the edge of the screen instead 
>> of 
>> > > being 
>> > > > wrapped.  Here is a layout that reproduces the issue. 
>> > 
>> > > > <android.support.v7.widget.GridLayout 
>> > > > xmlns:android="http://schemas.android.com/apk/res/android"; 
>> > > >  android:layout_width="wrap_content" 
>> > > >  android:layout_height="wrap_content" > 
>> > 
>> > > >     <TextView 
>> > > >       android:minWidth="100dp" 
>> > > >       android:text="test123" /> 
>> > 
>> > > >     <TextView 
>> > > >         android:text="test test test test tes test tes test test 
>> test 
>> > > test 
>> > > > test test test" /> 
>> > > > </android.support.v7.widget.GridLayout> 
>> > 
>> > > > When using the ICS version of GridLayout I can just add 
>> > > > android:layout_width="0dp" and 
>> android:layout_gravity="fill_horizontal" 
>> > > to 
>> > > > the TextView and it wraps the text instead clipping.  However when 
>> I try 
>> > > > that using the support library GridView the whole TextView 
>> disappears.  I 
>> > > > attached a screenshot from the Graphic Layout view in Eclipse that 
>> > > > demonstrates what is happening.  It looks like the second TextView 
>> is not 
>> > > > inheriting it's size from it's container but is the same width as 
>> the 
>> > > > device. 
>> > 
>> > > > Is there a different way to get this to work correctly? 
>> > 
>> > > > -- 
>> > > > 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 
>> > 
>> > > -- 
>> > > Romain Guy 
>> > > Android framework engineer 
>> > > romain...@android.com
>
>

-- 
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