Floating Action Button Doesn't Appear In Kitkat
I have created a single page app where the floating action button is used to share content from the page. It works flawlessly in android lollipop but when i ran the app on kitkat,
Solution 1:
I also have the same problem may be it is due to material design as material design introduced after kitkat so there be some problem on some tabs or layouts but try this it works for me maybe works for you..
<?xml version="1.0" encoding="utf-8"?><android.support.design.widget.CoordinatorLayoutxmlns: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:fitsSystemWindows="true"tools:context="com.ataraxianstudios.decksharer.MainActivity"
>
//Replace your fab from here
<ScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="#016cb4"><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="vertical"android:id="@+id/llMain"
><Spinnerandroid:id="@+id/osversions"android:layout_width="220dp"android:layout_height="wrap_content"android:layout_marginTop="10dp"
/><ImageViewandroid:layout_width="60dp"android:layout_height="80dp"android:id="@+id/selectedImage"
/></LinearLayout></ScrollView>
//to here:
<android.support.design.widget.FloatingActionButtonandroid: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="@drawable/share1"/></android.support.design.widget.CoordinatorLayout>
Solution 2:
Are you using design support library? This is an 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_input_add" />
And in your build.gradle:
dependencies { ..... compile 'com.android.support:design:xx.yy.zz' }
Finally, in your Activity you can reference the FAB like:
FloatingActionButtonbtn= (FloatingActionButton) findViewById(R.id.fab);
Hope it helps you!!
Solution 3:
Use bringToFront for you FloatingActionButton
fab = view.findViewById(R.id.fab_hours);
fab.bringToFront();
Post a Comment for "Floating Action Button Doesn't Appear In Kitkat"