【发布时间】:2017-09-06 12:22:11
【问题描述】:
我创建了一个简单的圆形按钮来为自定义对话框选择器创建 - 和 + 按钮。
如屏幕截图所示,- 和 + 稍微向下移动,而不是在自定义背景的中间。
我在drawable/circular_button.xml 中的自定义背景如下所示。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke android:color="@color/colorPrimaryDark" android:width="1dp" />
<solid android:color="@color/colorPrimary" />
<size android:width="30sp" android:height="30sp"/>
</shape>
按钮在LinearLayout里面是这样配置的
<Button
android:id="@+id/decrease_one"
android:layout_width="40sp"
android:layout_height="40sp"
android:layout_marginRight="20sp"
android:background="@drawable/rounded_button"
android:text="-"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold" />
在其中一篇文章中,我读到了标签minHeight,但它并没有解决我的问题。有什么想法吗?
【问题讨论】:
-
batter 使用 FlootingActionButton
-
它为您带来更多好处而不是为您创建自定义按钮
标签: android android-layout button floating-action-button