繁体   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