Hi is there anyone knows how to use the floating action button with andoidx library I think in android x library they replace
implementation 'com.android.support:appcompat-v7:xx.xx.xx'
by
implementation 'androidx.appcompat:appcompat:1.0.0'
but it's not helping any suggetion?
To use Floating action button in andoidx library use below dependencies
implementation 'com.google.android.material:material:1.0.0-rc01'
For more information check Migrating to AndroidX
XML code
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/imgFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_close"
app:backgroundTint="@color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@android:color/white" />
app:tint="@android:color/white"
is used to change the icon color ofFloatingActionButton
app:backgroundTint="@color/colorAccent"
is used to changebackground
color ofFloatingActionButton
To use
FloatingActionButton
inside activity or fragment we need to importFloatingActionButton
like this
import com.google.android.material.floatingactionbutton.FloatingActionButton