Reputation: 1
As i new in android development i just want to know is there any way to develop Android application for different screen sizes ?
help me.
Thank you in advance
Upvotes: -1
Views: 140
Reputation: 1
private val GESTURE_THRESHOLD_DP = ViewConfiguration.get(myContext).scaledTouchSlop
Upvotes: 0
Reputation: 796
Writing apps for multiple devices requires one to have good knowledge on basic concepts like : what is Dpi, Screen density , Orientation etc.
Article below is good place to start for:
Supporting Multiple Screens http://developer.android.com/guide/practices/screens_support.html
Upvotes: 0
Reputation: 8745
Google provide good article how to support multiple screens
http://developer.android.com/guide/practices/screens_support.html
General advices:
use layout - for for mobile phone layouts
use layout-sw600dp folder for 7inch tablets layouts
use layout-sw720dp folder for 10inch tablets layouts
use dimens.xml in values folder to define dimentions for your UI
you also can use
values-sw600dp and values-sw720dp with its own dimens.xml file for 7 and 10 inch tablets
Upvotes: 1
Reputation: 11323
Put your main.xml in those folders:
res/values/ //your default values (in your case for phones)
res/values-large/ //specfic values for relatively big screens
res/values-xlarge/ //specific values for really big screens
large: Screens that are of similar size to a medium-density VGA screen. The minimum layout size for a large screen is approximately 480x640 dp units. Examples are VGA and WVGA medium density screens.
xlarge: Screens that are considerably larger than the traditional medium-density HVGA screen. The minimum layout size for an xlarge screen is approximately 720x960 dp units. In most cases, devices with extra large screens would be too large to carry in a pocket and would most likely be tablet-style devices. Added in API level 9.
see more infos here: http://developer.android.com/guide/topics/resources/providing-resources.html#ResourceTypes
Upvotes: 1
Reputation: 377
Just add this in your project.
res/values/main.xml
res/values-sw600dp/main.xml -> 7+ inches
res/values-sw720dp/main.xml -> 10+ inches Create this folder and just copy your xml file in all the folders.
Upvotes: 1