微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使行的高度与Android设备中的屏幕高度相等

如何解决使行的高度与Android设备中的屏幕高度相等

| 我有三行,我想将这些行的大小固定为相等,这将基于我们为该表格提供的整个屏幕的大小,这意味着它将根据给定的高度平均划分三行,相同通过使用
android:stretchColumns=\"0,1\"
进行列。 Tabel结构如下:
<TableLayout android:layout_width=\"fill_parent\" android:id=\"@+id/tabelViewButtons\"
        android:layout_marginTop=\"10dip\" android:layout_height=\"fill_parent\"
        android:layout_below=\"@id/searchbar\" android:layout_above=\"@id/follow_notification_bar\"
        android:fitsSystemWindows=\"true\" android:stretchColumns=\"0,1\"
        >
    <TableRow >
        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_one\"></ImageButton>
        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_two\"></ImageButton>
    </TableRow>

    <TableRow >
        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_three\"></ImageButton>

        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_four\"></ImageButton>
    </TableRow>
    <TableRow >
        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_five\"></ImageButton>
        <ImageButton android:layout_height=\"fill_parent\"
            android:layout_width=\"fill_parent\" android:padding=\"5dip\"
            android:id=\"@+id/button_six\"></ImageButton>

    </TableRow>
    >

</TableLayout>

解决方法

为每个
TableRow
设置属性
android:layout_weight=\"1\"

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。