I have a problem displaying the icon on FloatingActionButton. The icon loses transparency. I have compileSdkVersion 28.
The dependencies are:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
//noinspection GradleDynamicVersion
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
implementation 'com.android.support:design:28.+'
implementation 'com.android.support:cardview-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.squareup.picasso:picasso:2.71828'
}
The layout is:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:background="@color/colorDivider"
tools:context=".activities.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabAddCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:clickable="true"
android:src="@mipmap/ic_plus"
app:backgroundTint="@color/colorPrimaryDark"
app:borderWidth="0dp"
android:focusable="true"/>
</FrameLayout>
and it looks like this:
Recently i faced may problem using 28.0.0-** library's
So i suggest u
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
And Change
compileSdkVersion 27
targetSdkVersion 27
Floating Button Example
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
add Dimesn
dimens.xml
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>
and I suggestion once again see the example for more clearance https://www.androidhive.info/2015/12/android-material-design-floating-action-button/