floating-action-button

Android FAB icon always black with MaterialComponents theme

我的梦境 提交于 2019-12-17 09:41:51
问题 I'm creating an Android app and I'm using the AndroidX libraries and Material design theme. My app theme on styles.xml is: <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> I have the following FAB from a custom library: <com.leinardi.android.speeddial.SpeedDialView android:id="@+id/work_log

FloatingActionButton with text instead of image

心不动则不痛 提交于 2019-12-17 08:34:06
问题 I'm trying to figure out how can be modified FloatingActionButton from android support library. Can it be used with the text instead of image? Something like this one: I see it extends ImageButton so I think not. Am I right? Is this correct in terms of Material Design in general? 回答1: With API 28 you can simply add text to Fabs using: Visit: https://material.io/develop/android/components/extended-floating-action-button/ <com.google.android.material.floatingactionbutton

Is it possible to set different actions for floating action button in differet fragments?

空扰寡人 提交于 2019-12-14 04:16:12
问题 I am working or an app where I have 4 fragments in viewpager and floating action button (fab). When I click on fab there appear 3 subfabs. Each of them start different activities where user can search data from different fragments. Is it possible to set fab so that if I click on it while I'm in first fragment it'll open an activity for searching inside this fragment, onClick inside second - search for second and etc. The issue is that now clicking on sub fab while I'm in some fragment I can

How to hide FAB on a particular fragment

坚强是说给别人听的谎言 提交于 2019-12-14 03:48:24
问题 Well I want to remove/hide FAB only on a particular fragment , HISTORY tab in my case . viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { .... (Overriding methods , I didnt do anything here }); My methods for inflating View Pager private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new HistoryFragment(), "HISTORY"); adapter.addFragment(new TransactionFragment(), "CURRENT");

How to fix shadow on scaled FloatingActionButton using support library 23

吃可爱长大的小学妹 提交于 2019-12-13 13:07:48
问题 I have a FAB on a KitKat device using support library 23. I'm scaling the button for a transition effect (by containing it in a resizing view). This basically works apart from the shadow, which appears in a weird form (see the scaled red button in the screenshot, the blue button is full size). What actually appears to happen is that the shadow is in 4 "corner" bitmaps that overlap to produce an odd effect. Does anyone know how this can be fixed? 回答1: This looks interesting! Unfortunately, I

How to remove grey shadow color below FloatingActionButton

血红的双手。 提交于 2019-12-13 02:36:06
问题 I am getting light grey color below the FloatingActionButton as shown in image. Any one know how to remove it. I tested it on Lollipop version. My xml code <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:src="@drawable/ic_add_black" app:borderWidth="0dp" app:fabSize="mini" app:rippleColor="@color

Hidden Floating Action Button popping up in CoordinatorLayout

痞子三分冷 提交于 2019-12-13 02:35:42
问题 I have an Activity with a ViewPager , which displays three different Fragments. Everything is inside a CoordinatorLayout . What I basically did is the same as in this answer: FAB animation with viewpager/tabslider I don't want to have the FAB in the first Fragment , so I set the FAB's visibility to GONE in the layout and show/hide it only when the 2nd Fragment is selected. This part actually works fine. However, when the Activity is first created(or the screen is rotated) the FAB pops up on

FloatingActionButton visible for sometime even if visibility is set to gone

谁说胖子不能爱 提交于 2019-12-13 00:51:03
问题 I am having a FAB (FloatingActionButton) in my LinearLayout. I want the LinearLayout to be hidden i.e. visibility set to gone at first and on clicking menu button it should get visible. Everything is working fine but FAB remains visible for sometime before hiding itself. I tried everything from changing visibility of FAB and using hide() and show() but nothing works. I got the following links but for some reason they don't work for me. FloatingActionButton always visible Gone FAB becames

Hide a Floating Action Button of another Layout

扶醉桌前 提交于 2019-12-12 08:38:32
问题 I have a FloatingActionButton inside of may activity_main.xml layout which is named fabBtn . My application is built with a ViewPager and three Fragment s.I want to hide the FloatingActionButton when my first Fragment detects a scroll, but I keep getting a NullPointerException if the user starts scrolling. I believe it could be that my fragment can't get the FloatingActionButton from the activity_main.xml layout? Here is my activity_main.xml <android.support.design.widget.CoordinatorLayout

Change color of Floating Action Button from Appcompat 22.2.0 programmatically

落爺英雄遲暮 提交于 2019-12-12 07:13:00
问题 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 回答1: Maybe late but could help. fab.setBackgroundTintList(ColorStateList.valueOf(Color .parseColor("#33691E"))); and parse the actual color code from a list of colors