Support All Screen Sizes
You may want to test this application on an emulator. You may want to test it on a phone.You may want to test it on a tablet.
The layouts we use in these tutorials will work on a variety of screen sizes, but they will work better if we tell Android that we do indeed those screen sizes.To that end, we need to modify the manifest for our project, to add a <supports-screens> element, declaring what sizes we support and do not.
Open the AndroidManifest.xml file in the root of your project tree, and add in a <supports-screens> element. The resulting file should resemble:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="apt.tutorial"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
/>
<application android:label="@string/app_name">
<activity android:name=".LunchList"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here, we are declaring that we support normal, large, and extra-large screens, but not small screens. Android will not automatically scale down our UI, so our application will not run on a small-screen device (typically under 3" diagonal screen size). However, it will run well on everything bigger than that.
The layouts we use in these tutorials will work on a variety of screen sizes, but they will work better if we tell Android that we do indeed those screen sizes.To that end, we need to modify the manifest for our project, to add a <supports-screens> element, declaring what sizes we support and do not.
Open the AndroidManifest.xml file in the root of your project tree, and add in a <supports-screens> element. The resulting file should resemble:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="apt.tutorial"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
/>
<application android:label="@string/app_name">
<activity android:name=".LunchList"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here, we are declaring that we support normal, large, and extra-large screens, but not small screens. Android will not automatically scale down our UI, so our application will not run on a small-screen device (typically under 3" diagonal screen size). However, it will run well on everything bigger than that.
No comments:
Post a Comment