简体   繁体   中英

How to remove those dark circular background from floating action button?

I am not able to remove those dark circle background from floating action button. By default it has a circle button with above circular shade. but some how couldnt find a way to remove that shade.

在此处输入图像描述

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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".VoipActivity"
android:id="@+id/VOIP_username">





<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="179dp"
    android:layout_height="185dp"
    android:layout_gravity="bottom|end"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    app:backgroundTint="@android:color/transparent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.502"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.844"
    app:rippleColor="?attr/colorBackgroundFloating"
    app:srcCompat="@drawable/preview" />[![enter image description here][1]][1]

You can use android:outlineProvider="none" .

Also, if you are using FloatingActionButton provided by the Material Components Library you can use a square fab just using the app:shapeAppearanceOverlay attribute.

Something like:

  <com.google.android.material.floatingactionbutton.FloatingActionButton 
          app:srcCompat="@android:drawable/..."
          app:shapeAppearanceOverlay="@style/SquareFabShapeOverlay"
          ../>

And in the style:

      <style name="SquareFabShapeOverlay" parent="ShapeAppearanceOverlay.MaterialComponents.FloatingActionButton">
        <item name="cornerSize">0dp</item>
      </style>

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM