Android smartPhone app support for Android Tablet

后端 未结 2 1647
南笙
南笙 2021-01-22 05:55

I am creating an application in Android. Originally i was making it only for smartphones but now i want that same app to uspport for Android Tablet. The problem is of scaling. I

相关标签:
2条回答
  • 2021-01-22 06:32

    The problem was with the min sdk version. If i set the min sdk version as 3 or less or not set it at all, the scaling problem occured. But if i set it to 4 or greater, it works perfectly fine. The application occupies the complete tablet screen height and width after setting the min sdk version equal or greater than 4.

    0 讨论(0)
  • 2021-01-22 06:39

    You want to read this piece of the manual: http://developer.android.com/guide/practices/screens_support.html

    (please, do read it!)

    But you could try adding the screen support in your androidmanifest.xml:

    The platform also provides a manifest element, whose attributes android:smallScreens, android:normalScreens, android:largeScreens, and android:xlargeScreens let you specify what generalized screen sizes your application supports.

    making it look like this:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <supports-screens
            android:smallScreens="true"
            android:normalScreens="true"
            android:largeScreens="true"
            android:xlargeScreens="true"
            android:anyDensity="true" />
        ...
    </manifest>
    

    The screen-support page also states this: (emph mine)

    Maintain compatibility with existing devices by leaving your application's android:minSdkVersion attribute as it is. You do not need to increment the value of the attribute to support new devices and multiple screens. Extend compatibility for Android 1.6 (and higher) devices by adding a new attribute — android:targetSdkVersion — to the uses-sdk element. Set the value of the attribute to "4". [To support xhdpi and xlarge screens, set the value to "9".] This allows your application to "inherit" the platform's multiple screens support, even though it is technically using an earlier version of the API.

    So the sollution as to update the minSdkVersion seems to be unwanted for the most general case. If you have '3' as a minSdkVersion for your situation, leave it at that, but add the targetSdkVersion for compatibility.

    0 讨论(0)
提交回复
热议问题