开发者

position view based on screen orientation in android

开发者 https://www.devze.com 2023-02-24 02:16 出处:网络
I want to change some views whe开发者_如何学Pythonn the orientation changes for example i want to put text view from bottom of the screen to screen\'s right side vertically when the orientation change

I want to change some views whe开发者_如何学Pythonn the orientation changes for example i want to put text view from bottom of the screen to screen's right side vertically when the orientation changes from portrait to landscape mode.How to achieve it?


Create two distinct layouts with the same name (i.e. mylayout.xml), and put one in res/layout-port and the other in res/layout-land. If you call

setContentView( R.layout.mylayout );

in the onCreate() method of your activity, then Android will select the correct layout depending on whether the device is in portrait or landscape orientation.

0

精彩评论

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

关注公众号