开发者

Developing an universal android application (phone and tablet) - Defining Orientations

开发者 https://www.devze.com 2023-03-24 06:47 出处:网络
I have developed an android application, which only supports portrait or开发者_JS百科ientation, for android phones. Now, I need to modify this app because I want to do the universal version (for table

I have developed an android application, which only supports portrait or开发者_JS百科ientation, for android phones. Now, I need to modify this app because I want to do the universal version (for tablets, too) but I have a problem. The phone version only supports portrait orientation and the tablet version supports portrait and landscape orientations. Is there any way to define different orientations for tablets and phones?

Thanks


I believe you can create a subfolder in the res/layout folder, called xlarge-land and xlarge-port with the xml files in them. the device itself will know what xml to load.

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

resource: http://developer.android.com/guide/practices/screens_support.html

0

精彩评论

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