安卓:如何为智能手机和平板电脑设计的应用程序? [英] Android: how to the design app for Smartphone AND Tablet?

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

问题描述

我知道已经有相当多的的博客项怎样的,<一个href=\"http://stackoverflow.com/questions/4832262/strategies-for-honeycomb-backward-compatibility\">questions在那里,包括Android 3.0的应用程序的向后兼容性。

I know there are already quite a lot of blog entries, how to's, questions out there that cover backward compatibility of Android 3.0 apps.

不过,阅读它们毕竟我只是比以前更糊涂了。 (

However, after reading them all I'm just more confused than before. :(

我有是支持min的智能手机应用程序。 SDK版本8(2.2)。

What I have is a Smartphone app that supports min. SDK version 8 (2.2).

我现在想这一个留在智能手机一样,也提供蜂窝片看中版本操作栏和片段等。

I now want this one to stay the same on Smartphones, but also provide a fancy version on Honeycomb Tablets with Action Bar and Fragments and so on.

我知道有一个兼容包,但我读到它是关于碎片。在操作栏和全息主题是什么?我做了好,易于只是在我的平板电脑改变targetSdkVersion11得到这个pretty。我怎么能与兼容包到达这个?

I know there is the compatibility pack, but all I read about it was about Fragments. What's with the Action Bar and the holographic Theme? I did get this pretty nice and easy just by changing the targetSdkVersion to "11" on my Tablet. How could I reach this with the compatibility pack?

或者你会说这是更好地开发两个不同版本的程序? (也许以后一起合并他们?)

Or would you say it's better to develop two different versions of the program? (And maybe merge them together later?)

亲切的问候,
水母

Kind regards, jellyfish

推荐答案

请单个APK,只是使用替代资源用于平板电脑。

Keep one apk and just use alternative resources for your Tablet.

看看:

的http:// code .google.com / p / iosched /来源/浏览/#汞柱%2Fandroid%2Fres

这节目的你如何定位在相同的APK智能手机和平板(蜂窝)的目录结构。

This show's you the directory structure of how to target SmartPhones and Tablets (with honeycomb) in the same APK.

修改

在Honeycomb版本看中

fancy version on Honeycomb

使用碎片不会更改用户界面蜂窝状它只是一个方式重新使用code。所以,你不需要碎片,使您的用户界面花哨

using Fragments won't change your UI in honeycomb it's just a way to re-use code. So you don't need Fragments to make your UI 'fancy'

编辑2

要查找当前运行的Andr​​oid版本,你可以这样做

To find the current running Android version you can do something like

int b = Integer.parseInt(Build.VERSION.SDK);              
if(b >= Build.VERSION_CODES.HONEYCOMB){
      Log.i(TAG, "Found A Tablet Running Honeycomb or newer");                  
 }

编辑3

在您的通话活动 getActionBar(); 则可以访问此处发表的所有操作栏的方法:的http://开发商.android.com /参考/安卓/应用/ ActionBar.html

in your Activity call getActionBar(); you then have access to all action bar methods stated here: http://developer.android.com/reference/android/app/ActionBar.html

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

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