Android - Setting for Tablets

≡放荡痞女 提交于 2019-12-08 12:25:26

问题


I am pretty new to Android. I wanted to know that if i want to design a tablet application then what changes i want make in the existing code which i designed for normal phone.

I did the Research and found,

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

and in Manifest

<supports-screens android:smallScreens="true" 
      android:normalScreens="true" 
      android:largeScreens="true"
      android:xlargeScreens="true"
      android:anyDensity="true" />

Is it all done?? or I want to change something other than this??


回答1:


You need to create new layout files for tablet versions, Java part is enough but layouts and image drawables are the main things you need.

Go through Supporting Multiple Screens, Here you will have a complete idea about how to create UI supporting Tablets and their res folders.

For all tablet resolutions check this link

below are the available resolutions for android mobile and tablet

1   2560*1600
2   1366*768
3   1280*800
4   1280*768
5   1024*768
6   1024*600
7   960*640
8   960*540
9   854*480
10  800*600
11  800*480
12  800*400
13  640*360
14  640*240
15  480*320
16  400*240
17  320*240

Most Common tablet resolutions are

Samsung Galaxy Tab 10.1 3G - 10.1 inches, 1280 x 800 pixels
Samsung P1000 Galaxy Tab - 7.0 inches, 600 x 1024 pixels



回答2:


For application to be worked, this is enough. But you should take care the size of the application When you are adding images to drawable folders it will increase your project size. So if you are using same images for all screens put that image in drawable folder. It will pick automatically to all screens, and if you want different image for different screen size put in different layout folders. You can make different layouts according to screen size to be fitted. The android will automatically pickup the proper xml files.




回答3:


add layout-large-hdpi folder to ur resources and copy the files from layout to created one, all ur created layouts will automatically converted to tablet screen size



来源:https://stackoverflow.com/questions/19316888/android-setting-for-tablets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!