Android的TableLayout高度不填充整个屏幕 [英] Android TableLayout height does not fills the whole screen

查看:100
本文介绍了Android的TableLayout高度不填充整个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有它只是一个单一的TableLayout的线性布局。
表布局还具有两排每两列。
一个表行有两个图像。
第二个表行有两个按钮。

但是,这并不完整的屏幕上显示,而只显示在上半年或者取决于图像高度。两个图像实际上是同一个文件,但具有不同的宽度示出。
请帮助...
这里是布局文件

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:方向=垂直>    < TableLayout
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_weight =1
        机器人:stretchColumns =*>        <的TableRow
            机器人:layout_height =FILL_PARENT>            < ImageView的
                机器人:ID =@ + ID / tp_image
                机器人:layout_width =0dip
                机器人:layout_height =FILL_PARENT
                机器人:layout_weight =0.9
                机器人:scaleType =fitXY
                机器人:SRC =@绘制/图像/>            < ImageView的
                机器人:ID =@ + ID / s_image
                机器人:SRC =@绘制/图像
                机器人:layout_width =0dip
                机器人:layout_height =FILL_PARENT
                机器人:scaleType =fitXY
                机器人:layout_weight =0.1
                />
        < /&的TableRow GT;
        <&的TableRow GT;
            <按钮
                机器人:ID =@ + ID / button_LC
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文字=@字符串/ button_LC/>
            <按钮
                机器人:ID =@ + ID / button_RC
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =WRAP_CONTENT
                机器人:文字=@字符串/ button_RC/>
        < /&的TableRow GT;
    < / TableLayout>
< / LinearLayout中>


解决方案

设置

 <的TableRow
    机器人:layout_height =0dp
    机器人:layout_weight =1>

到两个表中的行或只向第一行。

I have a linear layout with just a single TableLayout in it. The Table Layout further has two rows with two columns each. First Table Row has two Images. Second Table Rows has two buttons.

But this does not show up on the complete screen, rather only shows on the first half or maybe depends on the image height. Both the images are actually same file, but shown with different Widths. Help please... here is the Layout file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:stretchColumns="*">

        <TableRow
            android:layout_height="fill_parent">

            <ImageView
                android:id="@+id/tp_image"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="0.9"
                android:scaleType="fitXY"
                android:src="@drawable/images" />

            <ImageView 
                android:id="@+id/s_image"
                android:src="@drawable/images"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:scaleType="fitXY"
                android:layout_weight="0.1"
                />
        </TableRow>
        <TableRow >
            <Button 
                android:id="@+id/button_LC"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/button_LC"/>
            <Button 
                android:id="@+id/button_RC"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/button_RC"/>
        </TableRow>
    </TableLayout>
</LinearLayout>

解决方案

set

<TableRow
    android:layout_height="0dp"
    android:layout_weight="1" >

to both table rows or just to the first row.

这篇关于Android的TableLayout高度不填充整个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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