简体   繁体   English

如何修复android平板电脑的宽度和高度

[英]How can I fix android tablet's width and height

I am making android application in tablet using fragments so that I arranged 8 buttons vertically in 10.1 tablet it is showing fine but in 7.1 tablet only 5 icons it is showing.我正在使用片段在平板电脑中制作 android 应用程序,以便我在 10.1 平板电脑中垂直排列 8 个按钮,它显示正常,但在 7.1 平板电脑中仅显示 5 个图标。 So How can I manage height and width properly in all tablets ... please help那么如何在所有平板电脑中正确管理高度和宽度...请帮忙

Remember to write different xml layouts (with same name) and place to different folders: layout-large, layout-normal, layout-small and layout-xlarge.记住写不同的xml布局(同名)并放置到不同的文件夹:layout-large、layout-normal、layout-small和layout-xlarge。 Same is with drawables (different size images) and values (different type padding and other values).可绘制对象(不同大小的图像)和(不同类型的填充和其他值)也是如此。 These folders are for different phone/tablet types with various resolution and screen size.这些文件夹适用于具有各种分辨率和屏幕尺寸的不同手机/平板电脑类型。 If you do it, then you can easily manage layout for small device and not touch big screen devices.如果这样做,那么您可以轻松管理小型设备的布局,而无需触摸大屏幕设备。 Device is picking xml file automatically so it's good practice to place xml files in different folders for various phones.设备会自动选择 xml 文件,因此最好将 xml 文件放在不同手机的不同文件夹中。

More information you can find in http://developer.android.com/guide/practices/screens_support.html您可以在http://developer.android.com/guide/practices/screens_support.html 中找到更多信息

You can use different layout for different screen sizes.您可以为不同的屏幕尺寸使用不同的布局。 You can also add different buttons and other drawable also.您还可以添加不同的按钮和其他可绘制对象。 Please see the link请看链接

Supporting Multiple Screens 支持多屏

You can write different xml layouts using different folders: For example:您可以使用不同的文件夹编写不同的 xml 布局:例如:

res/layout
res/layout-sw600dp    //used by  7''
res/layout-sw720dp    //used by 10''

Also you can use the same layout with the same component but with different dimensions.您也可以使用具有相同组件但具有不同尺寸的相同布局。 You can use @dimen/my_dimen notation, and then put your my_dimen in different folders like:您可以使用@dimen/my_dimen符号,然后将 my_dimen 放在不同的文件夹中,例如:

res/values/dimens.xml
res/values-sw600dp/dimens.xml

and so on..等等..

Official doc: http://developer.android.com/guide/practices/screens_support.html官方文档: http : //developer.android.com/guide/practices/screens_support.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android平板电脑的宽度和高度图片有多少? - how much width and height image for android tablet? 在Android中,如何设置ListView项的高度和宽度? - In Android, how can I set a ListView item's height and width? 如何防止Android Samsung平板电脑上的带Phonegap的Jquery Mobile使用横向高度作为纵向高度? - How can I prevent Jquery Mobile with Phonegap on an Android Samsung tablet from using the landscape height for the portrait height? 如何在Android的WebView中修复图像高度和宽度 - How to fix image height and width in webview for android 我怎样才能获得android Honeycomb系统的屏幕宽度和高度? - How can I get android Honeycomb system's screen width and height? 如何在Android Studio布局编辑器中知道布局的总高度和宽度? - How can I know my layout's total height and width in Android Studio layout editor? 如何在android中获得设备的最大宽度和高度 - How do I get a device's maximal width and height in android 我如何将单元格高度设置为与Android TableLayout中的宽度相同? - How do i set cell height to be as it's width in android TableLayout? 为什么Android AlertDialog的宽度和高度= -1 - Why can Android AlertDialog's width and height = -1 如何在XML上将ImageView的宽度和高度设置为另一个ImageView的宽度和高度? - How can I set the width and height of an ImageView to another ImageView's width and height on the XML?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM