Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawable issue with theme

When building my app, I started just using the Theme.Light.NoTitleBar.Fullscreen theme. I built all my layouts for the whole app like this, and got things to look how I want them. Some drawables used in the layouts have their size specifically set, and others are set to wrap_content.

I then decided to switch to the Holo light theme. When I do this, all the drawables used in layouts that are set to wrap_content end up larger. Almost as if they are pulling from a larger bucket. In fact, some look like they've been stretched.

Holo Based Theme

Default PreHolo Theme

I know the background is black in the older theme one, but that's not an issue (this is actually a layout file that is included in another layout). Obviously there's quite a difference in size between the two.

like image 566
Ryan Avatar asked Dec 31 '13 23:12

Ryan


1 Answers

Here is just my guess based on what I read in this thread.

It can be because you use those images as background property of Button views. This is not safe because depending on default margin values - which are defined in the Theme - Buttons can stretch background images as they need to. If this is the case, then you need to use ImageButton views instead and use setImage*() method to assign images. There you can use scaleType property as it was mentioned by Carlos Robeles.

like image 171
sergej shafarenka Avatar answered Sep 30 '22 04:09

sergej shafarenka