Universal App for both tablets+handsets
I am developing a single application for both tablets and for handsets..My app is currently running fine on handsets(as according to layouts a开发者_StackOverflow社区nd all)..but i have no idea for how to distinguish it for handsets/tablets. I have seen some of the answers in Stackoverflow.com too, in which some people answered that use different layout-large,layout-xlarge.
but if the layout differs and we follow the above scenario,then in programming,it is written setcontentView(R.layout.---).
So we have to mention here also that setContentView(R.layout-large.---)..I am so confused with this..Can anyone suggest me something...
you only need to name the folder differently those contain same nameLayout.xml
like so
--layout
-- myLayout.xml
--layout-large
-- myLayout.xml
--layout-xlarge
-- myLayout.xml
on code, you only need to use
secContentView(R.layout.myLayout);
android will find the right one for you.
The android os will select the appropriate folder based on the device dimensions and other properties.
So you can keep the resource name same in all the folders and android will pick from the appropriate folder.
精彩评论