zoukankan      html  css  js  c++  java
  • Android TableRow 中的Textview显示不全

    最近碰到了这个问题。

    TabLayout 下面的 tabRow 中有2个TextView 如果输入的文本过长,会导致显示不全,这个问题真的困扰好几天了。

    这个是 TableLayout 中没有设置 android:shrinkColumns 熟悉

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
            
             <TableLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:shrinkColumns="1"
                 >
                 <TableRow
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content" >
    
                     <TextView
                         android:text="标题:" />
    
                     <TextView
                         android:text="@string/title1" />
                 </TableRow>
                 
                  <TableRow
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content" >
    
                     <TextView
                         android:text="标题:" />
    
                     <TextView
                         android:text="@string/title2" />
                 </TableRow>
                 
                   <TableRow
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content" >
    
                     <TextView
                         android:text="标题:" />
    
                     <TextView
                         android:text="@string/title3" />
                 </TableRow>
                 
                    <TableRow android:background="@color/actionbar_title_color"
                    >
                     <TextView
                         android:text="标题:" />
    
                     <TextView
                         android:text="@string/title4" />
                 </TableRow>
            </TableLayout>
    
    </LinearLayout>

    android:shrinkColumns

    The zero-based index of the columns to shrink. The column indices must be separated by a comma: 1, 2, 5. Illegal and duplicate indices are ignored. You can shrink all columns by using the value "*" instead. Note that a column can be marked stretchable and shrinkable at the same time.

    Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.

    This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

    This corresponds to the global attribute resource symbol shrinkColumns.

    Related Methods

    我的理解:

    android:shrinkColumns:以第0行为序,自动延伸指定的列填充可用部分:当LayoutRow里面的控件还没有布满布局时,shrinkColumns不起作用,设置了shrinkColumns=0,1,2,布局完全没有改变,因为LayoutRow里面还剩足够的空间。当LayoutRow布满控件时,设置了shrinkColumns=2,则控件自动向垂直方向填充空间

  • 相关阅读:
    jquery实现 图片延迟加载
    JSON在PHP中的应用
    【SAS NOTES】proc corr 检验变量相关性
    【SAS NOTES】proc freq 检验两分类变量
    【sas notes】proc sgplot拟合曲线
    【sas notes】proc sgplot折线图
    【sas notes】proc sgplot
    【SAS NOTES】proc reg 单变量线性回归
    【SAS NOTES】proc sgplot散点图
    【sas notes】sas9.2安装
  • 原文地址:https://www.cnblogs.com/ifzy/p/2985412.html
Copyright © 2011-2022 走看看