簡體   English   中英

浮動操作按鈕 (FAB) 默認以矩形顯示 - Android Studio

[英]Floating Action Button (FAB) appears in rectangle shape by default - Android Studio

我一直在開發需要 FAB 的 android 應用程序。 當我嘗試添加 FAB 時,它顯示為矩形而不是圓形。 默認情況下如何獲取圓形。

我在 gradle 中添加了implementation 'com.google.android.material:material:1.1.0依賴項

矩形浮動動作按鈕
fab.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProjectListActivity">

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="32dp"
        android:clickable="true"
        android:src="@drawable/ic_add_black_24dp"
        android:backgroundTint="@color/colorPrimary"
        app:fabSize="normal"
        app:rippleColor="@color/colorPrimaryDark" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

第一:重啟Andriod studio 第二:make clean project

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM