开发者

Creating photo miniature in a List View row

I want to cr开发者_JAVA百科eate a list with some text and a photo miniature in each row. So I created a row layout with a TextView and a ImageView, my question is how do I make the ImageView just a little square and then make an image adapt to the size of the ImageView?


<ImageView .... android:scaleType="centerInside" />

Set full screen image as an image resource of this image view. It will be downscaled automatically.

Additionally you can limit width and height setting android:maxWidth and android:maxHeight attributes to prevent minature to be too large.


my recommendation is you do not scale the image to fit the view as this is an expensive operation and will slow down your app it is preferable to prescale the item to the size you want.


Take a look at this Strange out of memory issue while loading an image to a Bitmap object. It's a correct way to get miniature with minimum memory consumption.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜