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,则控件自动向垂直方向填充空间

  • 相关阅读:
    HBase- 安装单机版HBase
    javascript中的设计模式之模板方法模式
    win 设置自动启动软件
    php高精度加减乘除
    frp实现内网穿透,实现夸服务器访问
    OCM 12c 直考预备知识点
    Oracle 19c New Features : Active Data Guard DML Redirect
    3级搭建类302-Oracle 19c RAC 双节点搭建
    VMWare WorkStation 15.5 配置RAC共享存储节点二无法识别共享磁盘UUID解决办法
    你还在争论 count(*) 与 count(column) 哪个更快?
  • 原文地址:https://www.cnblogs.com/ifzy/p/2985412.html
Copyright © 2011-2022 走看看