如何增加表行的高度根据屏幕? [英] How to increase the height of table row according to screens?

查看:127
本文介绍了如何增加表行的高度根据屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我怎么可以增加表行的高度,所以它看起来在更大的屏幕尺寸比例。目前所有的textviews和edittexts的(放置在表中的行)(仅在较大的屏幕尺寸)出现在屏幕的左侧,而不是占位整个屏幕的。
这里是我一起工作的XML:

 <滚动型机器人:ID =@ + ID / ScrollView01
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =FILL_PARENT
  的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=垂直
    机器人:layout_width =FILL_PARENT    机器人:layout_height =FILL_PARENT机器人:背景=@色/ black_background>< TableLayout
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_height =FILL_PARENT
    机器人:layout_width =FILL_PARENT
    >
  <的TableRow机器人:ID =@ + ID / TableRow01
               机器人:layout_width =FILL_PARENT
               机器人:layout_height =WRAP_CONTENT>
  < TextView的机器人:ID =@ + ID /名称
             机器人:layout_width =WRAP_CONTENT
             机器人:layout_height =WRAP_CONTENT
             机器人:TEXTSIZE =20SP
             机器人:文字颜色=@色/白
             机器人:知名度=看得见
             机器人:文字=@字符串/名称
             机器人:layout_weight =0.2
             机器人:layout_marginLeft =20dp
             机器人:layout_marginTop =22dp/> < EditText上机器人:ID =@ + ID / MYNAME
             机器人:layout_width =120dip
             机器人:layout_height =WRAP_CONTENT
             机器人:TEXTSIZE =20SP
             机器人:知名度=看得见
             机器人:layout_weight =0.3
             安卓的inputType =数字
             机器人:文字颜色=@彩色/ black_background
             机器人:layout_marginLeft =10dp
             机器人:layout_marginTop =10dp/> < TextView的机器人:ID =@ + ID / ERROR1
              机器人:layout_width =WRAP_CONTENT
             机器人:layout_height =WRAP_CONTENT
             机器人:TEXTSIZE =18sp
             机器人:文字颜色=@色/红
             机器人:知名度=看得见
             机器人:layout_weight =0.5/>  < /&的TableRow GT;
 <的TableRow机器人:ID =@ + ID / TableRow02
               机器人:layout_width =FILL_PARENT
              机器人:layout_height =WRAP_CONTENT>
  < TextView的机器人:ID =@ + ID /地址
             机器人:layout_width =WRAP_CONTENT
             机器人:layout_height =WRAP_CONTENT
             机器人:TEXTSIZE =20SP
             机器人:知名度=看得见
             机器人:文字颜色=@色/白
             机器人:文字=@字符串/地址
             机器人:layout_weight =0.2
             机器人:layout_marginLeft =20dp机器人:layout_marginTop =22dp/> < EditText上机器人:ID =@ + ID /地址
             机器人:layout_width =120dip
             机器人:layout_height =WRAP_CONTENT
             机器人:TEXTSIZE =20SP
             机器人:知名度=看得见
             安卓的inputType =数字
             机器人:文字颜色=@彩色/ black_background
             机器人:layout_weight =0.8
             机器人:layout_marginLeft =10dp机器人:layout_marginTop =10dp/>  < /&的TableRow GT;
< / TableLayout>    < / LinearLayout中>
 < /滚动型>


解决方案

使用

 安卓了minHeight =60像素

在标签的TableRow

 <的TableRow机器人:ID =@ + ID /独立写作的android:layout_width =FILL_PARENT
                    安卓了minHeight =60像素机器人:layout_height =WRAP_CONTENT>

I would like to know how can I increase the height of table row so it looks proportionate in larger screen sizes. Currently all of the textviews and edittexts(placed in table rows) appear on the left side of the screen instead of occuping the whole screen( only in larger screen sizes). Here is the xml I am working with:

<ScrollView android:id="@+id/ScrollView01" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent" 
  xmlns:android="http://schemas.android.com/apk/res/android">     

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"

    android:layout_height="fill_parent" android:background="@color/black_background">

<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"
    >
  <TableRow    android:id="@+id/TableRow01" 
               android:layout_width="fill_parent" 
               android:layout_height="wrap_content" >


  <TextView  android:id="@+id/name"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:textColor="@color/white" 
             android:visibility="visible" 
             android:text="@string/Name" 
             android:layout_weight="0.2"
             android:layout_marginLeft="20dp" 
             android:layout_marginTop="22dp"/>

 <EditText   android:id="@+id/myName"
             android:layout_width="120dip"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible" 
             android:layout_weight="0.3"
             android:inputType="number" 
             android:textColor="@color/black_background" 
             android:layout_marginLeft="10dp" 
             android:layout_marginTop="10dp"/>

 <TextView   android:id="@+id/error1"
              android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="18sp"
             android:textColor="@color/red" 
             android:visibility="visible" 
             android:layout_weight="0.5"/>

  </TableRow>
 <TableRow    android:id="@+id/TableRow02" 
               android:layout_width="fill_parent" 
              android:layout_height="wrap_content">


  <TextView  android:id="@+id/address"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible"
             android:textColor="@color/white" 
             android:text="@string/address" 
             android:layout_weight="0.2"
             android:layout_marginLeft="20dp" android:layout_marginTop="22dp"/>

 <EditText   android:id="@+id/address"
             android:layout_width="120dip"
             android:layout_height="wrap_content"
             android:textSize="20sp"
             android:visibility="visible" 
             android:inputType="number" 
             android:textColor="@color/black_background" 
             android:layout_weight="0.8"
             android:layout_marginLeft="10dp" android:layout_marginTop="10dp"/>

  </TableRow>
</TableLayout>           

    </LinearLayout>
 </ScrollView> 

解决方案

Use

      android:minHeight="60px"

On TableRow tag

      <TableRow android:id="@+id/task1" android:layout_width="fill_parent"
                    android:minHeight="60px" android:layout_height="wrap_content">

这篇关于如何增加表行的高度根据屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆