我正在尝试更改应用中几个按钮的高度。
我尝试将 @android:color/transparent
设置为 android:background
并且我还尝试将 layout_height
设置为类似的值16dp
。
我怎样才能让我的按钮的高度更小?
这是样式 xml:
<style name="Theme.PMBAppTheme.TextButton">
<item name="android:textStyle">bold</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@drawable/text_button_text</item>
<item name="android:background">#ff3300</item>
<item name="android:padding">0dp</item>
<item name="android:height">20sp</item>
</style>
布局:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/register_btn_privacy"
android:text="@string/privacy_policy"
style="@style/Theme.PMBAppTheme.TextButton"
/>
text_button_text
:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="true" android:color="@color/muted_pink_over" />
<item android:state_focused="false" android:state_pressed="true" android:color="@color/muted_pink_over" />
<item android:color="@color/muted_pink" />
</selector>
最佳答案
设置按钮的高度为wrap_content:
android:layout_height="wrap_content"
这应该将按钮的高度设置为最小值以显示其文本。
关于android - 改变按钮的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15073344/