3

我想在表格的左侧单元格中显示图像,在右侧单元格中显示文本。

我的问题是文本视图漂浮在可见屏幕之外,所以我看不到整个文本。文本应在屏幕可见的右端中断。我试图设置maxWidth一个像素值,但这不起作用。

任何人都可以为我的问题提供解决方案。也许有更好的布局选项?

我的布局定义:

<TableRow>
    <ImageView   
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:tint="#55ff0000"
      android:src="@drawable/bla"/> 
    <TextView  
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/aboutblaImageText" 
        android:textSize="6pt" 
        android:textColor="#FFF"
        android:maxWidth="100px"    
        />        
</TableRow> 
4

2 回答 2

1

尝试设置表的stretchColumns 和shrinkColumns 属性。它对我有用。

<TableLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:stretchColumns="0"
  android:shrinkColumns="1">

我从这篇文章中 Jonathan Roth 的回答中得到了这个想法。

于 2012-10-31T11:30:32.253 回答
0

android:shrinkColumns="1"属性添加到您的TableLayout.

于 2011-11-15T14:53:36.517 回答