I cannot seem to get the FAB button preview to work properly.
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/email_icon"
app:srcCompat="@android:drawable/ic_dialog_email"/>
The dependency - implementation 'com.google.android.material:material:1.2.1'
Preview
I have tried to change the drawable being shown to a normal vector image and also change app:srcCompat to android:src but no luck :(
I read that it may be a bug in the android studio - I have the 4.1.1 version installed.
Style/Theme file contents
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Kotlin" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/cyan</item>
<item name="colorPrimaryVariant">@color/cyan_dark</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/green</item>
<item name="colorSecondaryVariant">@color/green_dark</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
Color file contents
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="cyan">#006064</color>
<color name="cyan_light">#428e92</color>
<color name="cyan_dark">#00363a</color>
<color name="green">#81c784</color>
<color name="green_light">#b2fab4</color>
<color name="green_dark">#519657</color>
</resources>
Manifest file contents
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Kotlin">
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<activity
android:name=".MainActivity"
android:label="@string/tip_time">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
