Skip to main content
GameDev.net gamedev.net
🔒 Locked

Developing different views for different android devices?

Started by jblevins1991 Apr 8, 2012 at 9:21 PM 2 replies 1.9k views
Original Post
jblevins1991
jblevins1991
I have my main.xml page designed for tablets becuase they have more screen space. I made a second xml file named phone.xml and i was wondering if anybody knows how to make the app check what device is using the app and automatically change depending on if it is a tablet or smartphone.

So if it's a tablet it will use main.xml and if its a smart phone it will use phone,xml for the menu.
Zael
Zael
You may want to look into providing alternative resources from the sdk documentation
TechnoGoth
TechnoGoth

You may want to look into providing alternative resources from the sdk documentation


This is the easiest way to go for what you are looking to do. Its actually one of androids most powerful features.

Essentially you create two layout folders
layout
layout-xlarge

you place all your tablet specific layouts in the layout-xlarge and they will automatically be used on those devices. You don't need double up either so if you have the same layout on both the phone and tablet you just place it in the layout folder and it will be used everywhere.

You can do all sort of complicate layout changes using this method like:
layout-land and layout-xlarge-land if you want to use a different layout when the phone is in landscape mode.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.