我应该创建不同的布局文件夹来存储我的xml布局文件。为了支持我的应用程序在不同的屏幕尺寸我应该为不同的android手机制作不同的布局(xml文件)
我开发了一个应用程序,添加drawable时会自动创建像xdpi ldpi和更多不同的大小,但不自动创建布局xml文件以支持不同的屏幕大小。我应该这样做吗?并且我还会使用支持屏幕标签来编辑清单文件以支持不同的尺寸。这是全部?它也会支持我的风景或肖像模式。请确认我。我是新来堆栈和Android开发。
编辑: 相信在不同的文件夹不同的布局文件..也只是用代码显示对方只用文件夹名称变更的广告副本
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
这是我的布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_main"
tools:context="com.example.root.meeransunday.MainActivity">
<Button
android:id="@+id/button1"
android:layout_width="200dp"
android:layout_height="90dp"
android:text="Send Mobile"
android:drawableLeft="@mipmap/sms"
android:layout_alignParentBottom="true"
android:layout_marginRight="-1dp"
android:layout_marginLeft="-3dp"
android:layout_marginBottom="-4dp"
android:onClick="message"/>
<Button
android:id="@+id/button2"
android:layout_width="200dp"
android:layout_height="90dp"
android:text="QR Code"
android:drawableLeft="@mipmap/qr"
android:layout_marginLeft="190dp"
android:layout_marginRight="-20dp"
android:layout_marginBottom="-4dp"
android:layout_alignParentBottom="true"
android:onClick="scan"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_centerHorizontal="true"
android:text=" My Account Balance"
android:textColor="#0D47A1"
/>
<TextView
android:text="PKR 1527.87"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"
android:drawableLeft="@mipmap/money"
android:textSize="35sp"
android:id="@+id/textView2"
/>
</RelativeLayout>
清单文件:
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"
android:resizeable="true"/>
,但它不能在4我的工作nch屏幕。
请检查该链接https://developer.android.com/guide/practices/screens_support.html –
你检查'PercentRelativeLayout'? –