floating-action-button

Rotating FloatingActionButton

别来无恙 提交于 2019-12-20 06:21:05
问题 I believe most of you all have seen the rotating FloatingActionButton in apps such as Google keep, push bullet and even Google inbox app. I am trying to achieve this rotation by having an animation file that is : <?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="135" android:pivotX="50%" android:pivotY="50%" android:repeatCount="0" android:fillAfter="true" android:fillEnabled="true" android

Android - How to create FAB programmatically?

╄→尐↘猪︶ㄣ 提交于 2019-12-19 04:12:37
问题 I have an app with full of custom views. When I try to create a FAB programmatically, it throws an error Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library. Here is my code. private FloatingActionButton getFAB() { FloatingActionButton fab = new FloatingActionButton(getContext()); fab.setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_add_white_24dp)); return fab; } This is my app theme. <!--

How to remove FloatingActionButton's surrounding shadow?

房东的猫 提交于 2019-12-18 14:02:52
问题 I'm trying to replace the third party FloatingActionButton with the native one which is packaged in library com.android.support:design:22.2.0 .The default look has a dark shadow around the image,How can I get rid of it? I know the former one provides with the method setShadow() ,but I just can't find similar one from the latter. This is the related XML layout: <android.support.design.widget.FloatingActionButton android:id="@+id/alarm_front" android:layout_width="wrap_content" android:layout

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

余生长醉 提交于 2019-12-18 12:09:23
问题 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 回答1: There are

Two floating action buttons next to each other

人盡茶涼 提交于 2019-12-18 10:15:01
问题 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

New Bottom Layout from Google

心已入冬 提交于 2019-12-18 04:17:28
问题 First of all, I am sorry to ask a question like this but after I downloaded latest Google IO app, I am just loving the bottom Layout as shown in the following screenshot Being new to android development, I have no clue where to start, Any idea how to achieve this bottom Layout with circle star in XML? Does anyone know what this design is called? 回答1: You can use the new Material Components for Android and the BottomAppBar component. Use something like: <com.google.android.material

Outer Recyclerview not receiving scroll events of inner Recyclerview

杀马特。学长 韩版系。学妹 提交于 2019-12-18 04:07:16
问题 I followed this tutorial to implement the behaviors for both hiding the toolbar and the FAB when scrolled: https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/ I have pasted a demo of what the behavior looks like below. Now instead of those individual items within the recyclerview in the tabs holding just a textView, I have coded it so that they hold a picture (ImageView) and below it, a recyclerview showing a list of items. Hence, there is an outer

Is there a native component for the Floating action button in Android Material Design?

穿精又带淫゛_ 提交于 2019-12-17 19:25:59
问题 My question revolves around the Floating action button that was introduced in Android Material Design. There are many library offering this component on GitHub as: Android-floating-action-button FloatingActionButton CircularFloatingActionMenu Fab Floating-action-button But my question is: Is there a native component with the last release of android.support.vX that was built for Floating action button ? Components such as : android.support.v7.cardview android.support.v4.widget.DrawerLayout

Animating Fab on click (zoom in/out)

倾然丶 夕夏残阳落幕 提交于 2019-12-17 15:37:55
问题 I am trying to mimic animation and the color change for the following floating action button. The way the floating action button works is white is off and blue is on. However, I have been unsuccessful with the animation and changing the color. These have been my attempts at doing this, as you can see I have commented out all the different ways I have tried to do this. This is my code: @SuppressWarnings("unused") @OnClick(R.id.fabMovieFavourite) public void addMovieFavourite(View view) { /*

How to change android design support library FAB Button border color?

大兔子大兔子 提交于 2019-12-17 10:54:42
问题 I want to change fab button border color. border color is white, inside color is black or transparent I'd like my button to look like this: 回答1: fab.xml in drawable <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="0dp" android:shape="ring" android:thicknessRatio="2" android:useLevel="false" > <solid android:color="@android:color/transparent" /> <stroke android:width="3dp" android:color="@android:color/white" /> <