簡體   English   中英

適合所有屏幕尺寸

[英]Fit to all screen sizes

我做對了嗎? 我正在嘗試制作可在所有不同屏幕尺寸下使用的項目,因為從一開始我就使用API​​ 17(Nexus One)創建了該項目

<supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/fitnessku"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/AppTheme" >
        <compatible-screens>
            <!-- all small size screens -->
            <screen android:screenSize="small" android:screenDensity="ldpi" />
            <screen android:screenSize="small" android:screenDensity="mdpi" />
            <screen android:screenSize="small" android:screenDensity="hdpi" />
            <screen android:screenSize="small" android:screenDensity="xhdpi" />
            <!-- all normal size screens -->
            <screen android:screenSize="normal" android:screenDensity="ldpi" />
            <screen android:screenSize="normal" android:screenDensity="mdpi" />
            <screen android:screenSize="normal" android:screenDensity="hdpi" />
            <screen android:screenSize="normal" android:screenDensity="xhdpi" />
            <!-- all large size screens -->
            <screen android:screenSize="large" android:screenDensity="ldpi" />
            <screen android:screenSize="large" android:screenDensity="mdpi" />
            <screen android:screenSize="large" android:screenDensity="hdpi" />
            <screen android:screenSize="large" android:screenDensity="xhdpi" />
        </compatible-screens>

您需要為每個layout創建目錄。 將這些目錄添加到layout文件夾以支持多種屏幕尺寸。

  • layout-small
  • layout-normal
  • layout-large
  • layout-xlarge
  • layout-xxlarge

不要忘記在manifest文件中聲明它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM