gpt4 book ai didi

android - 如何删除Tablelayout中两行之间的空间?

转载 作者:行者123 更新时间:2023-12-05 00:17:37 24 4
gpt4 key购买 nike

我使用 Tablelayout 在屏幕上显示 6 个不同的图像。这是我的 xml 代码,

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical"
tools:context=".MainMenu" >

<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >

<ImageView
android:id="@+id/image1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />

<ImageView
android:id="@+id/image2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>

<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >

<ImageView
android:id="@+id/image3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />

<ImageView
android:id="@+id/image4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>

<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1" >

<ImageView
android:id="@+id/image5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />

<ImageView
android:id="@+id/image6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="@string/app_name"
android:src="@drawable/temp" />
</TableRow>
</TableLayout>

</LinearLayout>

输出如下图所示

enter image description here

我想删除两行之间的空格。如何做到这一点?

最佳答案

尝试将此 android:scaleType="fitXY" 属性添加到所有 ImageView 和 xml 中

关于android - 如何删除Tablelayout中两行之间的空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23668751/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com