gpt4 book ai didi

android - 使android Activity 适合所有屏幕尺寸

转载 作者:行者123 更新时间:2023-11-30 03:05:00 24 4
gpt4 key购买 nike

<分区>

这是我的 Activity 的 XML 文件。

如何在不弄乱图像按钮的情况下使其适合所有屏幕尺寸!

我正在使用相对布局,我应该改用线性布局吗?

以下是我的代码。

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:background="@drawable/good">

<ImageButton
android:id="@+id/ImageButton03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageButton1"
android:layout_alignTop="@+id/ImageButton01"
android:background="@drawable/btn_blue"
android:src="@drawable/plus"
android:onClick="NewCategory"/>

<ImageButton
android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ImageButton02"
android:layout_below="@+id/ImageButton02"
android:layout_marginTop="29dp"
android:background="@drawable/btn_blue"
android:src="@drawable/plus"
android:onClick="NewItem" />

<ImageButton
android:id="@+id/ImageButton04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/ImageButton01"
android:layout_alignLeft="@+id/ImageButton03"
android:background="@drawable/btn_blue"
android:src="@drawable/call" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="سـوبر ماركت التنـور"
android:textSize="40dp"
android:background="@drawable/btn_red"
android:textColor="@color/white" />

<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="24dp"
android:background="@drawable/btn_blue"
android:onClick="ViewAllCategories"
android:src="@drawable/cart" />

<ImageButton
android:id="@+id/ImageButton05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/ImageButton02"
android:layout_alignLeft="@+id/button1"
android:background="@drawable/btn_blue"
android:onClick="CreateNewUserAccount"
android:src="@drawable/user" />

<ImageButton
android:id="@+id/ImageButton02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ImageButton05"
android:layout_below="@+id/imageButton1"
android:layout_marginTop="33dp"
android:background="@drawable/btn_blue"
android:onClick="joinfacebook"
android:src="@drawable/f" />

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