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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -