【发布时间】:2021-04-20 11:07:15
【问题描述】:
我在我的 XML 活动中创建了一个 ImageButton,但它与暗模式不匹配。背景和图像的颜色仍然与普通模式相同。 我正在为这个 ImageButton 和其他按钮使用一个形状,我对按钮没有任何问题。
这是我的代码:
<ImageButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:background="@drawable/roundedbutton"
android:contentDescription="@string/actionButtonDescription"
android:padding="10dp"
android:src="@drawable/ic_baseline_add_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
这里是我的形状“roundedbutton.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/primaryColor"/>
<corners
android:bottomRightRadius="200dp"
android:bottomLeftRadius="200dp"
android:topRightRadius="200dp"
android:topLeftRadius="200dp"/>
我需要添加一些参数吗?
【问题讨论】:
标签: android xml kotlin imagebutton