There is no error for the FAB clicking it just won't execute onClick. I can click the button and it responds with lighting up but the Toast or log wont print.
[MAIN_ACTIVITY.XML]
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
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_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/recordings_placeholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.8"
android:gravity="center"
android:lineSpacingExtra="@dimen/small_margin"
android:padding="@dimen/activity_margin"
android:text="@string/no_recordings_found"
android:textSize="@dimen/bigger_text_size"
android:textStyle="italic"
android:visibility="visible" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recordings_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="20dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:backgroundTint="@color/transparentWhite" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/recordingFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_record_white"
android:backgroundTint="@color/recordRed"
android:tint="@color/white"
app:layout_anchor="@id/bottomAppBar"
app:useCompatPadding="true"
app:maxImageSize="35dp"
app:fabCustomSize="65dp">
</com.google.android.material.floatingactionbutton.FloatingActionButton>
MainActivity Class
Just remove fun onClick(v: View)
definition and it should work:
recordFabId.setOnClickListener {
// do your stuff on button click
}