Android 智能手机应用程序支持 Android 平板电脑 [英] Android smartPhone app support for Android Tablet

查看:56
本文介绍了Android 智能手机应用程序支持 Android 平板电脑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Android 中创建应用程序.最初我只为智能手机制作它,但现在我想要同样的应用程序支持 Android 平板电脑.问题是缩放.它没有被缩放到平板电脑屏幕的大小.我使用了高度和宽度为 fill_parent 的 LinearLayout.

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. It is not getting scaled to the size of Tablet screen. I have used LinearLayout with height and width as fill_parent.

推荐答案

您想阅读这部分手册:http://developer.android.com/guide/practices/screens_support.html

(请务必阅读!)

但是您可以尝试在 androidmanifest.xml 中添加屏幕支持:

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

该平台还提供了一个清单元素,其属性 android:smallScreens,android:normalScreens,android:largeScreens, 和android:xlargeScreens 让你指定你的一般屏幕尺寸是多少应用程序支持.

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.

让它看起来像这样:

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

屏幕支持页面 也说明了这一点:(emph 我的)

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

保持与现有的兼容性离开您的应用程序的设备android:minSdkVersion 属性 您不需要增加支持新的属性值设备和多个屏幕.延长兼容 Android 1.6(和更高)设备通过添加一个新的属性 — android:targetSdkVersion —到 uses-sdk 元素.设置值属性为4".[支持xhdpi 和 xlarge 屏幕,设置值为9".] 这允许您申请继承"平台的多屏支持,即使它在技术上使用较早版本的 API.

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.

因此,对于最一般的情况,更新 minSdkVersion 的解决方案似乎是不需要的.如果您将3"作为您的情况的 minSdkVersion,请保留它,但添加 targetSdkVersion 以实现兼容性.

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.

这篇关于Android 智能手机应用程序支持 Android 平板电脑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆