开发者

How to remove the android Button Background margins?

开发者 https://www.devze.com 2023-03-20 23:43 出处:网络
I\'m new to Android dev, I\'m trying sth simple: I want to place a set of 3 buttons horizontally in a开发者_Go百科 line, each with its own background PNG image. So I create a linear layout (horiz) and

I'm new to Android dev, I'm trying sth simple: I want to place a set of 3 buttons horizontally in a开发者_Go百科 line, each with its own background PNG image. So I create a linear layout (horiz) and put three Button elements, each with a weight of 1, and set each button's Background property to some png file. The buttons' width/height is set to wrap_content.

But what I get is that the png does not cover the entire button horizontal area. Instead, the background image is scaled down and keeps some sort of margin from the button view outline as shown in the visual designer. This also shows up in the emu. I tried forcing 0 in the layout's padding/margin - nada.

any idea on how to actually get the background image of a button to cover the button's background??

tnx


I believe you would need to make a new 9-patch, as that small margin is saved into the button image itself.


Try negative values for the buttons layout_margin.

0

精彩评论

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

关注公众号