简体   繁体   English

Android布局管理器缩放图像

[英]Android Layout Manager scaling images

I am using the Linear Layout Manager and I am trying to use the image width and height (wrapContent) automatically within the application. 我正在使用线性布局管理器,并且尝试在应用程序中自动使用图像的宽度和高度(wrapContent)。 However, all of the images are appearing larger than what they should be. 但是,所有图像看起来都比其应有的大。 I think I know why: If I put an image that is 320X480 on the screen, on my device that has a pixel resolution of 480X800, it fills up the entire screen. 我想我知道为什么:如果我在设备上的像素分辨率为480X800的屏幕上放置320X480的图像,则它将填满整个屏幕。 This results in all of my images being too big for this screen, as I am building my images for a screen size that is 480X800. 由于我要为480X800的屏幕构建图像,因此所有图像对于该屏幕而言都太大了。

Does anyone know how to fix this? 有谁知道如何解决这一问题?

u can use absolute layout! 您可以使用绝对布局! and can set the width and heigth of the image as u want! 并可以根据需要设置图像的宽度和高度!

go to the layout xml page and then change it to Absolute layout. 转到布局xml页面,然后将其更改为绝对布局。 then you can easily change the the width .. right click -> property 然后您可以轻松地更改宽度..右键单击->属性

set the height and wigth as u like... Eg:"120dip" 根据自己的喜好设置高度和摆动幅度,例如:“ 120dip”
it will solve your issue.. if not let me know will provide you another alternative 它将解决您的问题..如果不让我知道,将为您提供另一种选择

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

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