所有屏幕尺寸的Android通用布局

所有屏幕尺寸的Android通用布局,android,layout,scale,Android,Layout,Scale,上面是我的布局代码和不同屏幕密度的装置。即使我使用DPscale进行测量,我对不同的手机也会得到不同的结果。我真的需要为不同的密度制作各种不同的布局吗?更好,不是硬编码宽度,而是使用相对于屏幕的匹配\u parent和填充物或边框,因为也有无用的框架布局,您可以简单地移除 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas



上面是我的布局代码和不同屏幕密度的装置。即使我使用
DP
scale进行测量,我对不同的手机也会得到不同的结果。我真的需要为不同的密度制作各种不同的布局吗?

更好,不是硬编码宽度,而是使用相对于屏幕的
匹配\u parent
和填充物或边框,因为也有无用的
框架布局
,您可以简单地移除
<FrameLayout 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"
             tools:context="com.main.turkkusu.radyo.MessageFragment"
             android:id="@+id/scream_frame">

    <!-- TODO: Update blank fragment layout -->

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="120dp"
        android:layout_centerHorizontal="true"
        >


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <EditText

                android:textColor="@color/colorAccent"
                android:maxLength="150"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="textNoSuggestions|textCapSentences"
                android:ems="10"
                android:id="@+id/message_scream_text"
                android:layout_marginLeft="19dp"
                android:layout_marginStart="19dp"
                android:hint="Bir şeyler söyleyin..."
                android:windowSoftInputMode="adjustResize|adjustPan"
                android:layout_alignParentBottom="true"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_marginBottom="16dp" />

            <Button
                android:text="Gönder"
                android:layout_width="100dp"
                android:layout_height="wrap_content"
                android:layout_marginRight="19dp"
                android:layout_marginEnd="10dp"
                android:id="@+id/message_scream_button"
                android:layout_alignBaseline="@+id/message_scream_text"
                android:layout_alignBottom="@+id/message_scream_text"
                android:layout_alignParentRight="true"
                android:layout_alignParentEnd="true" />

            <ProgressBar
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true"
                android:id="@+id/scream_progressbar" />

            <RelativeLayout
                android:layout_width="300dp"
                android:layout_height="300dp"
                android:layout_centerHorizontal="true"

                android:id="@+id/pool_layout">

                <ScrollView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/scream_scroll"
                    android:layout_alignParentTop="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">

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

                        <TextView
                            android:textColor="@color/colorPrimary"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:id="@+id/message_pool_view"
                            />
                    </LinearLayout>
                </ScrollView>

            </RelativeLayout>

        </RelativeLayout>
    </FrameLayout>

</FrameLayout>