开发者

Getting LayoutParams.WRAP_CONTENT to ignore a large background image

I'm trying to make a LinearLayout that has height = LayoutParams.WRAP_CONTENT.

I am receiving an arbitrarily sized bitmap from a server to set as the background image for the LinearLayout.

How do I set the background image of the LinearLayout without resizing the view if the received bitmap is larger than the contents of the linear layout?

It would be nice if the background image could maintain its aspect ratio, and scale to match t开发者_运维百科he width of the screen.

I tried overriding onMeasure as a temporary solution, but that just wound up biting me.


how about using an imageView inside your layout , which also has its adjustViewBounds set to true in order to keep aspect ratio?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜