Is there a way to completely eliminate padding in a LinearLayout containing buttons?

前端 未结 1 628
既然无缘
既然无缘 2020-12-06 23:35

I tried the following to try to display two buttons in a horizontal linear layout, with the edges of the buttons flush with the border of the linear layout. To my surprise,

相关标签:
1条回答
  • 2020-12-07 00:32

    If you're meaning you want them to be pushed to the edge, pixel for pixel, you'll need to use your own 9-patch for the button background, as the default one in Android has a few extra pixels around the border of its 9-patch background. For an example of this, look at the file in your SDK folder under:

    platforms/android-8/data/res/drawable-hdpi/btn_default_transparent_normal.9.png

    For example, this is what I get with the default:

    alt text

    And with a custom 9-patch I had made earlier:

    alt text

    0 讨论(0)
提交回复
热议问题