如果我设置背景颜色,使用这种风格的按钮之间的边距比没有它时要小得多。为什么?我该如何解决这个问题?
<style name="RemoteButton">
<!-- Leaving this in makes the buttons very close together, without it, the margins increase -->
<item name="android:background">#d6d7d7</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:textColor">#556699</item>
<item name="android:textSize">20dp</item>
<item name="android:layout_margin">3dp</item>
</style>
最佳答案
默认按钮样式不是颜色,它是具有内部填充/边距的可绘制资源 (@android:drawable/btn_default
)。上面有一些资料here但相关的不多。我会进一步研究 android 样式及其工作原理。
至于如何修复它,我会看here .
关于android-layout - 在按钮样式上设置背景颜色时,它会更改边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27372691/