我創建了一個簡單的圓形按鈕來爲自定義對話框選取器創建 - 和+按鈕。圓形自定義按鈕中的內聯對齊標題
正如截圖-
看到和+
移位一點點的時候,在自定義背景的中間不居中。
我在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
的職位之一,但它並沒有解決我的problem.Any想法?
麪糊使用FlaotingActionButton –
它給你帶來更多的好處,而不是你創建一個自定義按鈕 –