floating-action-button

How to rotate floating action button without rotaing shadow?

北城以北 提交于 2019-11-29 18:04:28
问题 I rotate the FAB in such a simple way: fab.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate)); rotate.xml : <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:duration="1000"/> </set> This works, but together with the FAB its shadow rotates. But I need only the FAB to rotate (or even its src image, if there's any

How to Animate a Fab button (zoom in/out) continuously?

徘徊边缘 提交于 2019-11-29 16:56:05
I Want to create this type of animation on FloatingActionButton What I have tried public void animFab() { ObjectAnimator scaleX = ObjectAnimator.ofFloat(fab, View.SCALE_X, from, to); ObjectAnimator scaleY = ObjectAnimator.ofFloat(fab, View.SCALE_Y, from, to); ObjectAnimator translationZ = ObjectAnimator.ofFloat(fab, View.TRANSLATION_Z, from, to); AnimatorSet set1 = new AnimatorSet(); set1.playTogether(scaleX, scaleY, translationZ); set1.setDuration(500); set1.setInterpolator(new AccelerateInterpolator()); set1.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd

Move Floating Action Button above keyboard

谁说我不能喝 提交于 2019-11-29 14:09:44
I have this Floating Action Button (GitHub link) and when I open a (software) keyboard the Floating Action Button hides behind the keyboard. Is there a way that I can push it above the keyboard? Edit: tab_random.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <View android:layout_width="match_parent" android:layout_height="156dp" android:background="@color/primary_color" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/from" android

FloatingActionButton does not come down when dismissing Snackbar

一个人想着一个人 提交于 2019-11-29 13:53:44
问题 I am trying to use a Snackbar . I have a FloatingActionButton wrapped in a CoordinatorLayout . When the Snackbar shows, the button is correctly moved up. When it dismisses automatically, the button moves down. But if I dismiss the Snackbar programmatically, the button does not go down. My code is simple: mSnackbar = Snackbar.make(mCoordinatorLayout, text, Snackbar.LENGTH_LONG) .setAction(R.string.undo, new View.OnClickListener() { @Override public void onClick(View v) { undoDeleteTasks(); } }

Android - Movable/Draggable Floating Action Button (FAB)

一笑奈何 提交于 2019-11-29 11:19:59
问题 I am using a FloatingActionButton in my app. Occasionally, it overlaps essential content, so I would like to make it so the user can drag the FAB out of the way. No drag and drop functionality, per se, is required. It just needs to be movable. The docs do not mention this, but I'm sure I've seen such functionality in other apps. Can you anyone advise / provide a code snippet on how to do it (preferably in XML). 回答1: So, you wanna create a Movable FloatingActionButton , huh?! Based on this

Change image Floating Action Button Android

烂漫一生 提交于 2019-11-29 09:03:39
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. 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.drawable.ic_shopping_cart_white); you can use this in your .XML : android:src="@drawable/icon" // change

Android setBackgroundTintList on pre-lollipop devices

十年热恋 提交于 2019-11-29 02:20:45
问题 I'm working with FloatingActionButton . The user should be able to switch the FAB background color within a onClick Event. However, the recommended call to setBackgroundTintList seems to be only compatible from 21+ API. How do I - correctly - go about it on pre-lollipop devices? Is there any alternative I could use? Thanks in advance. 回答1: You can use also setSupportBackgroundTintList Applies a tint to the background drawable. Does not modify the current tint mode, which is SRC_IN by default.

Anchor ImageView to Collapsing Toolbar

做~自己de王妃 提交于 2019-11-29 00:40:47
When a FloatingActionButton is anchored to a CollapsingToolbarLayout, it disappears when you scroll up, reappears when you scroll down after a certain point. I was wondering if you can do that with any type of view. In my app, I'm trying to anchor an ImageView to the CollapsingToolbarLayout but it won't disappear like the FloatingActionButton. Here's the XML code. <android.support.design.widget.AppBarLayout android:id="@+id/bar" android:layout_width="match_parent" android:layout_height="252dp" android:fitsSystemWindows="true"> <android.support.design.widget.CollapsingToolbarLayout android:id="

Javascript FAB framework on Node.js

与世无争的帅哥 提交于 2019-11-28 23:12:52
I've seen a slide that presented Fab , a node.js framework. Is this JavaScript? Could someone explain what is going on in that code? I'm all lost. Is plain JavaScript, it is a function chaining pattern. The first line, ( fab = require("fab") ) includes the fab function and returns a reference to it. All the subsequent parentheses are function calls, each function invocation returns probably the same function again and again. The pattern probably looks like this simplified example: var foo = function (arg) { // detect what the argument is if (typeof arg == 'function') { // do something with arg

How to animate FloatingActionButton of new Design Support Library

安稳与你 提交于 2019-11-28 23:02:16
问题 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? 回答1: 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