Android TableLayout height does not fills the whole screen

帅比萌擦擦* 提交于 2019-12-22 03:58:41

问题


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>

回答1:


set

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

to both table rows or just to the first row.



来源:https://stackoverflow.com/questions/11635393/android-tablelayout-height-does-not-fills-the-whole-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!