开发者

Supporting Multiple resolution devices Android

I am stuck in a situation. I created an application for Samsung Galaxy Tab 7". The same application when i run on the HTC Flyer it shows very small fonts.

I tried following : I thought may be the screen of HTC Flyer is xhdmi so i crated folders accordingly

res -> values-large-xhdmi -> styles.xml -> &l开发者_开发问答t;item textsize>20</item>
res -> values-large-> styles.xml -> <item textsize>16</item>

this is not working.. :( any help will be highly appreciable in this regard.

Thanks.


Check out this recent blog post on sizes: http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html

A typical 7” tablet has a 1024x600 mdpi screen. This also counts as a large screen.

The original Samsung Galaxy Tab is an interesting case. Physically it is a 1024x600 7” screen and thus classified as “large”. However the device configures its screen as hdpi, which means after applying the appropriate ⅔ scaling factor the actual space on the screen is 682dp x 400dp. This actually moves it out of the “large” bucket and into a “normal” screen size. The Tab actually reports that it is “large”; this was a mistake in the framework’s computation of the size for that device that we made. Today no devices should ship like this.

So you need to think of the Galaxy as a large sized screen but with hdpi. THe HTC Flyer will be large sized screen but with mdpi.

When specifying sizes you need to stick with dp, as this normalizes all sizes to scale appropriately for the different density screens. Use a dimension to specify in a xml value resource.

As milind hinted (i think), it is probably better to use the same style for these two screen sizes and specify a dimen resource. This resource can then be customized for the different displays.

The bottom line, however, is that you are using text size differences based on the screen size. The text size should be indicated in dp, so it will scale accordingly to any screen density. Really, the only resources that should be based on screen size are layouts.


If you are plan to make Multiple resolution Supporting android application just you have care about image and xml no other needs that you have same images with three different size putting in different folders like drawable-hdpi, drawable-ldpi, drawable-mdpi. you can make style.xml common for all.

Thanks

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜