开发者

Android: advanced text drawing (columns, fixed height, paging). How?

开发者 https://www.devze.com 2023-01-28 14:48 出处:网络
I\'m porting application from iPad to Galaxy Tab and, since I hadn\'t had much experience with programming for Android devices I\'d like to know some \"general\" things.

I'm porting application from iPad to Galaxy Tab and, since I hadn't had much experience with programming for Android devices I'd like to know some "general" things.

I've used CoreText for all m开发者_Go百科y ipad text drawing needs, what can I use in Android? How can I break large text apart dividing it in to frames/paths and then layout them on screen (think, columns in news application articles). It looks like that Paint class does some things related to what I need, but I don't know if that's the proper way to go.

Please, enlighten me :)


The Layout object is what you are looking for, in particular its subclass StaticLayout. It's what's used by TextView to shape the text and render it on screen. It's basically a smart wrapper around the various methods offered by Paint to measure and draw text.


Personally I would wait for Honeycomb, maybe Gingerbread if you're lucky. Currently Android is not optimized for tablets, plain and simple (can you imagine developing on the iPad with just the standard iPhone SDK?)

Gingerbread is going to be announced before the new year and we might get some tablet goodies, but Honeycomb (release soonish?) is when full tablet support will be available.

For the timebeing maybe develop for the standard phone size, but keep it modular enough so the upgrade for tablets is painless.

0

精彩评论

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