English 中文(简体)
图像大小加倍
原标题:Image Size Doubling

这或许是一个快速的答案, 但我一定不知道该寻找什么, 因为找不到人谈论它! 我在我的绘图文件夹里有一些 png 文件, 是 88x88 像素。 我运行了我的应用程序, 并用日志打印了图像的大小, 并声称图像是 176x176 。 是什么? 在图像进入 Apk 之前, 是什么东西在扩展我的图像? 还是我的手机只是它声称的分辨率的一半?

最佳回答

BitmapFactory. decodeResource 比例图像,根据设备的 DPI 文件夹中 可下载 图像(它为高分辨率屏幕生成高分辨率图像) 。

如果您不想在解码上缩放图像, 请将其放在文件夹 Drawable- nodpi

问题回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签