android: dynamically change FAB(Floating Action Button) icon from code

Changing FloatingActionButton source: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { floatingActionButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_full_sad, context.getTheme())); } else { floatingActionButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_full_sad)); } This can be replaced by following code from the support library instead: floatingActionButton.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_full_sad));

Hide FloatingActionButton on scroll of RecyclerView

Easiest solution: recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy > 0 ||dy<0 && fab.isShown()) { fab.hide(); } } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { if (newState == RecyclerView.SCROLL_STATE_IDLE) { fab.show(); } super.onScrollStateChanged(recyclerView, newState); } });

Two floating action buttons next to each other

It is a combination of layout gravity and anchor gravity together with playing with the margins (of the anchored item) that can make it work, have a look at the xml below which I have used successfully: <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=”https://stackoverflow.com/questions/31205720/@android:drawable/ic_dialog_info” /> <android.support.design.widget.FloatingActionButton android:id=”@+id/fab2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”top|end” android:layout_marginBottom=”0dp” android:layout_marginEnd=”0dp” android:layout_marginLeft=”0dp” android:layout_marginRight=”0dp” android:layout_marginStart=”0dp” … Read more

FloatingActionButton hide on list scroll

Those who are looking to make it with recyclerview can do this: recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy > 0 || dy < 0 && fab.isShown()) fab.hide(); } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { if (newState == RecyclerView.SCROLL_STATE_IDLE) fab.show(); super.onScrollStateChanged(recyclerView, newState); } });

Flutter – FloatingActionButton in the center

I don’t know if this was added since this question was first answered, but there’s now floatingActionButtonLocation property on the Scaffold class. It would work like this in your original question: class ContaPage extends StatelessWidget { @override Widget build(BuildContext context) => new Scaffold( // … floatingActionButton: new FloatingActionButton( // …FloatingActionButton properties… ), // Here’s the … Read more

Android FAB plus sign not present on android drawable

You can find the plus icon on the Vector Asset Studio. In Android Studio, open an Android app project. In the Project window, select the Android view. Right-click the res folder and select New > Vector Asset. Click the Android icon Button and look for the plus sign More info here: https://developer.android.com/studio/write/vector-asset-studio.html#materialicon

Android How to implement Bottom Sheet from Material Design docs

Edit The BottomSheet is now part of the android-support-library. See John Shelleys’ answer. Unfortunately there’s currently no “official” way on how to do this (at least none that I’m aware of). Luckily there’s a library called “BottomSheet” (click) which mimics the look and feel of the BottomSheet and supports Android 2.1 and up. In case … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)