【发布时间】:2021-06-04 00:05:51
【问题描述】:
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:contentDescription="TODO"
android:focusable="true"
android:scaleType="fitCenter"
app:backgroundTint="@color/black"
app:fabSize="auto"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBox6"
app:maxImageSize="100dp"
app:srcCompat="@drawable/add"
app:tint="@color/blue" />
我想在Button中使图片居中,我尝试使用约束布局,但它在FloatingActionButton内部不起作用。 我更改了我的代码,但它不起作用。
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="60dp"
android:clickable="true"
app:backgroundTint="#000000"
app:fabCustomSize="50dp"
app:elevation="0dp"
app:borderWidth="0dp"
app:fabSize="normal"
app:pressedTranslationZ="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="100dp"
app:srcCompat="@drawable/add"
app:tint="@color/blue" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
【问题讨论】:
-
我更改了代码,但没有用。
标签: android floating-action-button