floating-action-button

Change color of Floating Action Button from Appcompat 22.2.0 programmatically

半城伤御伤魂 提交于 2019-11-30 08:04:06
I would like to know how to change the Floating Action Button color from the Support library 22.2.0 ? I've tried button.setBackgroundColor(color); but clearly, this changes the drawable of the button and it turns to a square. Now I wonder how to change the color but just the color, without touching the shape? Thanks in advance Maybe late but could help. fab.setBackgroundTintList(ColorStateList.valueOf(Color .parseColor("#33691E"))); and parse the actual color code from a list of colors You can find here Create a ColorStateList and set it as the background tint: button.setBackgroundTintList(new

Change image Floating Action Button Android

﹥>﹥吖頭↗ 提交于 2019-11-30 07:45:12
问题 I used this library https://github.com/futuresimple/android-floating-action-button. How can I change the image of the main button? I want to change the button image right after selecting one of the smaller buttons. 回答1: From https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html As this class descends from ImageView, you can control the icon which is displayed via setImageDrawable(Drawable). Or you can use setImageResource(): fab.setImageResource(R

Android: How to change size of app:fabSize=“normal” for Floating Action Button

こ雲淡風輕ζ 提交于 2019-11-30 05:59:49
When using the new FloatingActionButton , the size is determined by app:fabSize="normal" . How can I set what in dp is the size referenced by "normal" ? I tried to create values/attrs.xml : <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="app"> <attr name="fabSize"> <enum name="mini" value="50dp" /> <enum name="normal" value="100dp" /> </attr> </declare-styleable> </resources> But I get the error "normal" in attribute "fabSize" is not a valid integer H.S.H There are two different sizes of FAB available: normal or mini Normal (56dp)  — This size should be used in most

Setting src and background for FloatingActionButton

会有一股神秘感。 提交于 2019-11-30 05:01:34
问题 When I use background and src in android.support.design.FloatingActionbutton it is not set correctly. Instead it is displayed as <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/pink" android:src="@drawable/ic_action_barcode_2" android:layout_gravity="bottom|right" android:layout_marginBottom="16dp" android:layout_marginRight="16dp" /> but when I use ImageView it

How to add floating action button on top of scrollview

爷,独闯天下 提交于 2019-11-30 03:18:59
问题 I have a floating action button that I would like to add on top of a scrollview so that the button stays, even if you scroll. I want it on the top of the scrollview and in the bottom right corner of the screen. What combination of views do I need to use to accomplish this? Here is the xml file: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match

How to animate FloatingActionButton of new Design Support Library

北城余情 提交于 2019-11-30 02:05:38
I am using a TabLayout with 5 different fragments. On 3 of these fragments a android.support.design.widget.FloatingActionButton should appear. Right now I simply set the visibility of the FAB when the tab changes, but I would like to have an animation, where the FAB comes in and out. How can I achieve this in Android? The hide/show animation for shrink/pop are automatically handled by the new version of the Support Library.(22.2.1) Then OnTabChange listener show or hide the floating action button using show/hide methods provided by the new library. fab.show(); or fab.hide(); The design support

Set FAB icon color

元气小坏坏 提交于 2019-11-30 01:12:31
current FAB I would like to know how to change the icon color of the FAB (Floating Action Button) widget supplied by the 'com.android.support:design:22.2.0' library from green to white. style.xml <resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/color_primary</item> <item name="colorPrimaryDark">@color/color_primary_dark</item> <item name="colorAccent">@color/accent</item> </style> <color name="color_primary">#00B33C</color> <color name="color_primary_dark">#006622</color> <color name="accent">#FFB366</color> activity_main.xml <?xml

Using Support Design Library in Eclipse

会有一股神秘感。 提交于 2019-11-29 22:03:35
问题 I'm working on a project that unfortunately hasn't been migrated to Android Studio yet. I want to utilize the floating action button in Google's new support.design library but I can't manage to get it included in my project. I updated the support libraries in the Android SDK Manager. First, I tried importing the library into Eclipse and adding it as a dependency using Project → Properties → Android on my app but the design project isn't showing up as a library project. Then I tried copying

Two floating action buttons next to each other

一笑奈何 提交于 2019-11-29 20:45:18
The material design documentation has an example of Google Maps showing two floating action buttons next to one another (actually, one above the other). How is this done? I have two FAB's in a coordinator layout, but they end up on top of one another, so you only see one button. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- Use ThemeOverlay to make the toolbar and

Using Google Design Library how to hide FAB button on Scroll down?

感情迁移 提交于 2019-11-29 20:26:58
Google have released Design library, I am using compile 'com.android.support:design:22.2.1' However I cant see any code examples of how to use this library and how to animate the FAB bar on scroll. I guess I can listen for scroll events on the ListView and then animate the button myself, but is this not baked into the API (is this not the point of this support library). Is there examples for this ? If you're using RecyclerView and you're looking for something simple, you can try this: recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){ @Override public void onScrolled