Creating an Alternate Layout and Resources
Android provides an alternate layouts and resources based upon the devices used.
If we develop any apps in portrait form then it may not look good in landscape mood.
Here i am gonna develop an alternate layout for landscape mood.
Then lets start.
I create a new project named "Alternate"
Then i go to XML file and drag a button, a textview, togglebutton and a imageview.
Here is portrait view
Layout in Protrait View |
When i switch this layout to landscape it looks like this and it is not good.
Layout view in Landscape mode |
So i need to create a alternate layout for landscape. For this i create a new directory or folder in res folder
called layout-land.
Then i create a XML file called activity_main.xml inside it.
Now i drag button ,textview, toggle button and imageview and placed in a suitable format and way.
Alternate Landscape mode |
My layout is not good right now but you can do better than this .
I just run my project and it looks like this.For landscape enter ctrl+f11
Potrait View |
Landscape View |
No comments:
Post a Comment
Did this post help you? Do you have any questions? Drop your thoughts here...