Android:如何设计智能手机和平板电脑的应用程序?

发布于 2024-11-09 18:54:30 字数 700 浏览 8 评论 0原文

我知道已经有很多 博客条目< /a>, 操作方法, 问题涉及 Android 3.0 应用程序的向后兼容性。

然而,读完所有这些之后,我比以前更困惑了。 :(

我拥有的是一款支持最低 SDK 版本 8 (2.2) 的智能手机应用程序。

我现在希望该应用程序在智能手机上保持不变,但也在 Honeycomb 平板电脑上提供带有操作栏和片段等的精美版本。

我知道有兼容包,但我读到的只是关于操作栏和全息主题的内容?我只需在平板电脑上将 targetSdkVersion 更改为“11”就可以了。我可以通过兼容性包实现这一点吗?

或者您认为开发两个不同版本的程序更好?(也许稍后将它们合并在一起?)

亲切的问候, 海蜇

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. :(

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静待花开 2024-11-16 18:54:31

保留一个 apk,然后为您的平板电脑使用替代资源。

看一下:

http://code.google.com /p/iosched/source/browse/#hg%2Fandroid%2Fres

这向您展示了如何在同一 APK 中定位智能手机和平板电脑(带有蜂窝)的目录结构。

编辑

Honeycomb 上的精美版本

不会改变 Honeycomb 中的 UI,这只是重用代码的一种方式。因此,您不需要 Fragments 来让您的 UI 变得“精美”

EDIT 2

执行类似

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

EDIT 3

要查找当前运行的 Android 版本,您可以在 Activity 调用中 的操作 getActionBar(); 然后您就可以访问所有操作这里声明的 bar 方法: http://developer.android.com/reference/android/应用程序/ActionBar.html

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

Take a look at:

http://code.google.com/p/iosched/source/browse/#hg%2Fandroid%2Fres

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

EDIT

fancy version on Honeycomb

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'

EDIT 2

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");                  
 }

EDIT 3

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

謌踐踏愛綪 2024-11-16 18:54:31

今年的 Google IO 上有一次关于这个主题的演讲。现已在 YouTube 上推出 http://www.youtube.com/watch?v=WGIU2JX1U5Y& ;feature=youtube_gdata_player

There was a talk on this very subject at Google IO this year. Now available on YouTube http://www.youtube.com/watch?v=WGIU2JX1U5Y&feature=youtube_gdata_player

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文