can any one tell me it is possible to show different number of columns in listview
For Example:- when i see listview in portrait mode it shows 3 columns and when i see listview in landscape mode it shows 4 columns . i try to do it but my solutions doesn't work for me , i define to different layout for protrait in layout folder and landscape in layout-land folder but it doesn't seens to work for me .
Can any one tell me is it possible to achive this .
And one More thing it possible to execute some code by checking
For Example:- if(this is android phone){
execute this code;
}
if(this is android tablet){
execute this code;
}
like iphone and ipad developer do
if(this is iphone )
{
execute this code ;
}
if(this is ipad )
{
execute this code ;
}
because i same application is used in both phone and tablet and some one wants to show different things in phones and different in tablets .
Thanks in advance
Try this below link for tutorial
http://www.technotalkative.com/android-multi-column-listview/
Thanks..!
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
this gives the dimensions of the screen and based on these values you can determine if it is a tablet.. See this link to know how to get dimensions of your device
Create more layouts with same name in /res/layout
After selecting root element click "Next" and then choose one of the Available qualifiers (orientation) and define listView with its properties.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.