My question is related to this one.
When I open the NavigationDrawer, the Floating Button is on the top of it but has to be below.
I try to do it like that :
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
Log.i(TAG , " inner onDrawerSlide");
super.onDrawerSlide(drawerView, slideOffset);
fabButton.setAlpha(25);
float alpha = 0.2f;
AlphaAnimation alphaUp = new AlphaAnimation(alpha, alpha);
alphaUp.setFillAfter(true);
fabButton.startAnimation(alphaUp);
syncState();
}
and like that :
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerClosed(view);
invalidateOptionsMenu();
fabButton.setAlpha(255);
syncState();
}
Nothing worked for me. What can be the solution ?
My layout:
<mobapply.freightexchange.customviews.FragmentNavigationDrawer
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<!-- The ActionBar -->
<include
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- The main content view -->
<FrameLayout
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/lvDrawer"
android:layout_width="match_parent"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="#FFFFFF"
android:cacheColorHint="@android:color/transparent"
/>
FragmentNavigationDrawer is the custom DrawerLayout
To change background color of Floating Action Button in Kotlin Android, set the backgroundTint attribute (in layout file) or backgroundTintList property (in Kotlin file) of FAB with the required color.
floatingActionButton: Padding( padding: const EdgeInsets. all(8.0), child: Visibility( visible: buttonshow, child: FloatingActionButton( onPressed: () { scrollToTop(); }, shape: const StadiumBorder( side: BorderSide(color: Color(0xff135888), width: 2.5)), backgroundColor: Colors.
From the Android documentation for setAlpha(float alpha) (since API 11):
Sets the opacity of the view. This is a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.
You're trying to set it to value 25
or 255
:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With