layout - Android: how to prevent dynamic background drawable from stretching -


i need set layout's background dynamically calling myview.setbackgrounddrawable(bitmapdrawable bdb), want crop image rather stretching in layout, there way doing it?

i trying create drawable below set gravity, challenge can't hardcode android:src static drawable since image source has dynamic.

<bitmap android:src="@drawable/background" android:gravity="center" /> 

any suggestion appreciated!

you want use imageview.scaletype.center_crop


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -