繁体   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