Have you tried setting an android:ellipsize attribute on the textviews?
http://developer.android.com/reference/android/widget/TextView.html#attr_android:ellipsize

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Tue, Apr 24, 2012 at 6:35 AM, Barkside <barkside.a...@gmail.com> wrote:

> I'm attempting to use GridLayout so I can generate a complicated layout on
> the fly.  However text inside TextViews is not getting clipped to columns
> as I would imagine they would.  To demonstrate what I mean, below is a
> simple example.
>
> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android";
>>     android:layout_width="match_parent"
>>     android:layout_height="match_parent"
>>     android:columnCount="3" >
>>     <TextView
>>         android:layout_column="0"
>>         android:layout_columnSpan="1"
>>         android:maxLines="1"
>>         android:text="00000000000000000000000000000000000000000000" />
>>     <TextView
>>         android:layout_column="1"
>>         android:layout_columnSpan="1"
>>         android:maxLines="1"
>>         android:text="111111111111111111111111111111111111111111111" />
>>     <TextView
>>         android:layout_column="2"
>>         android:layout_columnSpan="1"
>>         android:maxLines="1"
>>         android:text="222222222222222222222222222222222222222222222" />
>> </GridLayout>
>
>
> I would expect across a small screen the following text, where each column
> crops the content within it:  *00000000011111111222222222*
> But instead I get (where the second TextView is highlighted in blue):
> <https://lh5.googleusercontent.com/-SfQXngN7xwI/T5aa27WnASI/AAAAAAAAAAM/itoZ4WcIU0w/s1600/crop.png>
>
>
>
>
>
>
>
>
>
> I would have thought that since the GridLayout is match_parent (i.e. the
> screen), and columnCount is 3, all columns should squash together and fit
> on the screen.
>
> Now, I have tried various things to get the desired result, including a
> fixed layout_width of the GridLayout, clipChildren to true, a fixed
> layout_width of 0dp and layout_gravity fill_horizontal for each TextView
> (which just gives me 222222222222).  I have tried various layout_gravity
> values for the TextViews, including CLIP_HORIZONTAL.  I don't want to have
> to calculate the desired width and manually set that for each TextView.
>
> Any help out there please?
>
>  --
> 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

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