简体   繁体   中英

How to Develop only one android application for both phones and Tablets?

i want to develop an application that support resolution for both phones and tablet and for both layouts protrait and landscape .So can any one suggest me what i have to do for that ? Thanks in advance .

I created a tool that allows you to scale/adjust your layouts for tablets and small screen devices and made a blog post about it here: http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html

Basically, defining your layouts in dp units for one size is not enough if you want your app to fit on all devices and tablets, since there's four different "density-buckets". This tool will allow your layouts to be converted into fitting these density buckets.

It really depends on the type of application. I've been doing raw drawing in OpenGL and with SurfaceViews, so I make sure I get viewport or canvas height and width and scale things accordingly.

If you have very specific UI elements, take into account DPI to ensure a button or widget is a minimum size.

See this link: http://developer.android.com/guide/practices/screens_support.html . You can place your xml-Layouts for Tablet in 'layout-xlarge-land' and for phones in 'layout-large-land' or in the normal layout-land. For Portrait-Mode just place you xmls in 'layout-port'- Folders.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM