position view based on screen orientation in android
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.
精彩评论