开发者

What's the best way to support Android 2.x tablets in my app?

I'm developing an Android app that absolutely needs to support Android 2.1+ devices, including tablets and phones.

The tricky part is I want to be able to provide roughly the same user experience on Android 2.x tablets as on bone fide Honeycomb tablets. I'm planning on using the Compatibility package so that Fragment support is always available, but...

The problem I've got at the moment is I've bought a Hannstab for testing, and discovered that it reports to apps that it has a "large" screen, despite actually being 10.1 inches. This would technically make it "xlarge", but of course that category was not included in Android 2.2 (which it runs), hence it's "large". I originally intended to just use resource qualifiers and treat all xlarge devices as tablets, and everything else as phones but now I realise I can't do that.

Would it be so bad to treat all xlarge and large screened devices as tablets? This would include Dell Streaks and other 5 to 7 inch screen devices as I understand it.

Is there a better alternative? I haven't really got my head around fragments properly yet so a fragments-based solution might be obvious to someone who has.

I've noticed that typically, apps I install on my Hannspad use their normal phone UI, with the exception of Evernote which uses a specific tablet interface - I wish I knew how they'd done that.

The new "Smallest Width" resource qualifier introduced in Android 3.2 would solve this problem by doing away with the generalised screen size buckets altogether. Presumably I could copy this approach by writing code to work out the screen width in dp and then adding fragments to the activity as a开发者_StackOverflow中文版ppropriate. Is that wise? I'd rather avoid that kind of work if it's going to be a pain.

Cheers


Would it be so bad to treat all xlarge and large screened devices as tablets?

If your question really is "is it OK to use the same layouts, etc. for -large and -xlarge devices", that certainly can work. It's certainly where I would start.

Bear in mind that device manufacturers really are the ones who determine what is -large or not. It would not surprise me to find some manufacturers creating 5" devices to categorize them as -normal, because they feel that -normal apps tend to work better on their devices than do -large apps.

I've noticed that typically, apps I install on my Hannspad use their normal phone UI, with the exception of Evernote which uses a specific tablet interface - I wish I knew how they'd done that.

Probably using -large/-xlarge resources. I don't know if they are using fragments or not.

In terms of screen sizes, fragments really are for cases where the -large/-xlarge UIs are basically a bunch of -small/-normal sized UIs snapped together like LEGO(R) blocks. In Evernote's case, their -large/-xlarge UI does not fit that pattern, so they may or may not have used fragments.

Fragments offer some other advantages for memory management and configuration changes (e.g., screen rotation), so you might consider using fragments even if you are not sharing fragments between major groups of screen sizes.

Is that wise?

If possible, I would hold off on making that decision until Ice Cream Sandwich ships and we start seeing how some of this stuff will play out on smaller-screen devices.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜