Android Studio中的设计

Android Studio中的设计,android,android-studio,android-xml,Android,Android Studio,Android Xml,有没有办法在Android Studio中进行设计,在.xml中使用multipleScreen支持而不使用填充和边距来设计edittext 我的代码不支持多屏幕(它超出了屏幕)。请帮我设计一个代码,支持多屏内屏 大多数情况下,设计不应使用衬垫和边缘 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" a

有没有办法在Android Studio中进行设计,在.xml中使用
multipleScreen
支持而不使用填充和边距来设计
edittext

我的代码不支持多屏幕(它超出了屏幕)。请帮我设计一个代码,支持多屏内屏

大多数情况下,设计不应使用衬垫和边缘

<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:orientation="vertical"
android:layout_gravity="center_horizontal|center"
android:gravity="center_horizontal|center_vertical"
android:weightSum="3"
tools:context=".MainActivity">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="MOBILE"
        />

</RelativeLayout>
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    android:layout_weight="1"
</RelativeLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1">

</RelativeLayout>

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"></LinearLayout>

android:layout_weight=“1”

通过代码创建界面,并在px上设置其元素大小,这样您就不会有任何硬编码尺寸,并且在所有屏幕上都看起来正常

看看


希望这能有所帮助。

无论何时使用垂直线性布局的砝码,都要将孩子的身高设定为0dp。 请尝试以下代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="3">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Mobile"
        android:layout_centerInParent="true"/>
</RelativeLayout>


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Mobile"
        android:layout_centerInParent="true"/>
</RelativeLayout>


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Mobile"
        android:layout_centerInParent="true"/>
</RelativeLayout>

希望能有帮助。 多谢各位