简体   繁体   English

拉伸Android设备的图像

[英]stretch images for Android devices

I have been programming an application for Android. 我一直在为Android编写应用程序。 I want to target it for more devices(tablets, smartphones). 我想将其定位为更多设备(平板电脑,智能手机)。 I tried to find some info at http://developer.android.com/guide/practices/screens_support.html but it does not work correctly. 我试图在http://developer.android.com/guide/practices/screens_support.html上找到一些信息,但是它无法正常工作。

I want to automatically stretch images on different devices, not only in my testing device. 我想不仅在测试设备上自动在其他设备上拉伸图像。 I draw images for the mobile full screen (which has the same resolution as my mobile). 我在全屏(与我的手机具有相同的分辨率)上绘制图像。 But, for example in the tablet it draws incorrectly. 但是,例如在数位板中,它绘制不正确。 I tried to change the size and it gives several folders(lhdpi, small, ...). 我试图更改大小,它提供了几个文件夹(lhdpi,small,...)。 When I tried to start it again in the tablet, it was bigger but still incorrect (there was a black space on the edges). 当我尝试在平板电脑中再次启动它时,它更大但仍然不正确(边缘上有一个黑色空间)。 I have several images in my application, and I want to retain the same size as in the mobile too. 我的应用程序中有几张图片,我也想保留与移动设备相同的尺寸。 Please, help me. 请帮我。

Sorry for my spelling mistakes. 对不起,我的拼写错误。

you have to maintain aspect ratio at your own . 您必须自己保持宽高比。 don't put same sized images in all folder (hdli, mdpi, ldpi), if this was the case they think why android provides different foldes ? 不要在所有文件夹(hdli,mdpi,ldpi)中放入相同大小的图像,如果是这种情况,他们会认为为什么android提供不同的折叠? put images in ratio 0.75 : 1 : 1.5 . 以0.75:1:1.5的比例放置图像。 it will work . 它会工作。 additionally read about 9-patch images, this will make your life much easier . 另外阅读有关9补丁图像的信息,这将使您的生活更加轻松。

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

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