[英]How can I make images fit every device on android application
I am inserting buttons and images which should touch the borders horizontally of the android device's width, but they are not a result there is little space left on both the sides of the button and images. 我正在插入按钮和图像,它们应该水平接触android设备宽度的边界,但这并不是结果,按钮和图像的两侧都几乎没有剩余空间。 And when I test the app on a larger dimension device the images and button appear pretty small comparatively.
当我在较大尺寸的设备上测试该应用程序时,图像和按钮相对较小。 What should I do?
我该怎么办?
These links will help you to create application for multiple screens : 这些链接将帮助您为多个屏幕创建应用程序:
http://developer.android.com/training/multiscreen/screensizes.html http://developer.android.com/training/multiscreen/screensizes.html
http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/practices/screens_support.html
These are android's official documents on implementing support for multiple screen sizes. 这些是android的有关实现对多种屏幕尺寸的支持的官方文档。
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Add this to your manifest file of your application. 将此添加到您的应用程序的清单文件。
there is little space left on both the sides of the button and images
按钮和图像两边的空间很小
Try changing the margin and padding of your UI components. 尝试更改UI组件的边距和填充。
And when I test the app on a larger dimension device the images and button appear pretty small comparatively.
当我在较大尺寸的设备上测试该应用程序时,图像和按钮相对较小。
Android documentation provides pretty detailed information on what size image should be used for various screen sizes. Android文档提供了有关各种屏幕尺寸应使用哪种尺寸图像的相当详细的信息。 You might want to read that.
您可能想要阅读。
In your XML file you can use android:scaleType
. 在您的XML文件中,您可以使用
android:scaleType
。 See documentation for scaleType . 有关scaleType,请参见文档。
scaleType is a bit difficult to understand with the provided description unless you use each scale type and see its effects for yourself. 除非您使用每种比例类型并亲自查看其效果,否则使用所提供的说明很难理解scaleType。
Programmatically you can do something like this but it would very much depend on your particular use case requirement. 您可以通过编程方式执行此类操作,但这在很大程度上取决于您的特定用例需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.