我正在尝试实现以下目标:
一个[占据整个屏幕的三个图像按钮菜单,其中三个必须是等于高度,宽度将是设备的,我很难做到这一点,使用ConstraintLayout可以使它“响应”,但取决于设备大小,出现间隙,不确定原因:
这是我的布局:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#921B1F33"
tools:context="com.example.minacar.MainActivity">
<ImageButton
android:id="@+id/transferButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/descripcion_button_1"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/menutransfer"
/>
<ImageButton
android:id="@+id/rentaCarButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/descripcion_button_2"
android:scaleType="fitXY"
app:layout_constraintBottom_toTopOf="@+id/transferButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/menurent" />
<ImageButton
android:id="@+id/carButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/descripcion_button_3"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/transferButton"
app:srcCompat="@drawable/menucar" />
非常感谢您的帮助或指导,谢谢!! >>
不确定是否有用,我使用的图像是三个相同的大小,1417x929 PNG。
我正在尝试实现这样的目标:占据整个屏幕的三个图像按钮菜单,其中三个必须高度相等,宽度等于设备的宽度,我很难过...] >
<LinerLayout android:orientation = "vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#921B1F33"
tools:context="com.example.minacar.MainActivity">
<ImageButton
android:id="@+id/carButton"
android:layout_width="match_parent"
android:layout_height="0dp"
android:weight = "1" />
<ImageButton
android:id="@+id/carButton"
android:layout_width="match_parent"
android:layout_height="0dp"
android:weight = "1" />
<ImageButton
android:id="@+id/carButton"
android:layout_width="match_parent"
android:layout_height="0dp"
android:weight = "1" />
<LinerLayout>