开发者

a question on Multi screen support: How to check in Java code

In my android application, I have layout xml files in:

layout/ , layout-lan

and

layout-xlarge , layout-xlarge-lan folders to support multiple screen sizes.

They are working fine, my application is running on different screen size tablets.

I have one table in my layout, textview components are inserted to the table on fly in Java code. In order to support multi screen size devices, I need to check if the device has large screen size (that's match layout-xlarge) or normal screen size(match layout/) in Java code (on fly) also to set the text size of TextView.

My question is how to check the screen size match layou开发者_运维百科t/ or layout-xlarge in Java code?


If i understand your implementation correctly, nothing needs to be done programmatically.

If the TextViews you are adding on the fly are uniform, just make a separate resource that is this TextView. Then, you can make two different TextViews, specified for each layout. Android will choose at runtime which to use.

This way you can have two different textsizes specified in the two different textviews or create another resource.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜