There are lots of custom libraries for achieving the FAB menu thing. But I want it to be done without using any custom libraries. I want to achieve this FAB Menu natively.
Please don't suggest me any custom library
You can go for android's design library. add this gradle in to your build file
compile 'com.android.support:design:23.0.1'
and follow this link, which is a stackoverflow link tells how to use. and this is the link of an sample app.
Example :
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
android:src="#drawable/ic_done"
app:layout_anchor="#id/viewA"
app:layout_anchorGravity="bottom|right|end"/>
you can create multiple fab and play with its visibility
UPDATE
I think you have to use third party library to do this. please go through this library, this might help you
add this dependency to the app build.gradle
compile 'com.android.support:design:23.1.0'
compile 'com.github.clans:fab:1.6.2'
Add follow the below link Floating Action Menu
You could do this natively using visibility...
Each press on the FAB (ImageView) will toggle visibility with an animation.
I won't write a working sample code, but this should be enough info to help implement a custom floating action button in this way.
XML
android:onClick="fabMainClicked"
JAVA
public void fabMainClicked(View view)
{
ImageView fabDrop1 = (ImageView) findViewById(R.id.fabDrop1);
ImageView fabDrop2 = (ImageView) findViewById(R.id.fabDrop2);
if (fabDrop1.getVisibility() == fabDrop1.GONE)
{
fabDrop1.setVisibility(fabDrop1.VISIBLE);
fabDrop2.setVisibility(fabDrop2.VISIBLE);
}
}
Each ImageView will need to be animated via a custom animator to slide up or onto the screen.
Each ImageView will use a res/drawable as the background to provide a circle and a res/drawable for the center image.
Scale type should be set to center.
Good luck.
Related
I need to create a modal alert with some animated progress indicator. I've found this example below, and I'd like to create something like this:
I already know how to implement the circular progress indicator, but this effect at the end is new to me.
Has anyone seen a similar effect? (Circular progress indicator with effect in the end)
Is this some kind of gif? And if it is, how can I add a gif to a view on Android?
You can use this well known library AnimCheckBox. Here is an screenshot what will you get.
How to use?
Add this dependency to your app level build.gradle
dependencies{
compile 'com.hanks.animatecheckbox:library:0.1'
}
Then in your layout.xml
<com.hanks.library.AnimateCheckBox
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="15dp"
app:animDuration="200"
app:checkedColor="#00f"
app:lineColor="#fff"
app:lineWidth="1.2dp"
app:unCheckColor="#ff0"/>
When following this Android tutorial using AppCompat V7 to get the new Tool Bar work, the android.support.v7.widget.Toolbar supports android:elevation on SDK's < Lollipop. This is because they use android.support.v7.widget.Toolbar and not Toolbar.
Is there equivalent for button? Something like android.support.v7.widget.Button? (This one not exist) Or any other workaround in the kind of overlaying the Button in some view supporting elevation? (I don't want implementation of creating custom shapes with gradients for look & feel of elevation).
Thanks,
You can use the Floating Action Button from support design library .
Use below code to the layout where you want this button.
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_fab"
android:layout_gravity="bottom|end"
app:backgroundTint="#0091b4"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
android:layout_margin="10dp"
android:scaleType="centerCrop" />
Do add design dependency in your project
Add below in the dependency list of build.gradle file
compile 'com.android.support:design:23.0.1'
Unfortunately you will have to do what you do not want. Because there is no support button view yet. (As i know :) perhaps some omniscient person will correct my answer)
The default lollipop apps(like dialer in motoG) has some rounded iconic buttons in the LISTVIEWS and also the TOOLBAR, please refer the screenshot
Please tell me what are these buttons as per my understanding 2,3 are TOOLBAR(actionbar) icons and I assume 1 button is the floating action button.
Please share a sample code to create a button like the ones in the image especially the 1st button.
That button is pretty straight forward. Using the AppCompat library lets you use ?attr/selectableItemBackgroundBorderless as a background, which achieves the desired effect.
<ImageButton
android:src="#drawable/some_drawable"
android:layout_width="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_height="wrap_content" />
This is a fab button.
Include Angular Material in your project then use the following code to create a 'Comment' fab button.
<md-button class="md-fab" aria-label="Comment">
<md-icon md-svg-src="img/icons/ic_comment_24px.svg"></md-icon>
</md-button>
i want to make view like this with a button at the bottom. how can i do it? i am new to material design. I tried RecyclerView but i don't know whats that button.
you have to use FloatingActionButton try this.
http://developer.android.com/samples/FloatingActionButtonBasic/index.html
Visit https://github.com/vinc3m1/RoundedImageView/
this library can help you.
When you add library to your project write your xml file like that:
<com.makeramen.roundedimageview.RoundedImageView
android:id="#+id/imageViewID"
android:layout_width="40dp"
android:layout_height="40dp"/>
Is there a way I can Achieve the floating button to work on 4.0 and later android??
I've seen it on google plus but I haven't found any tutorial. Only for android l preview. What did google+ use to achieve it?
You can now use the FloatingActionButton from the support-design library. Add this dependency to your gradle build file:
compile 'com.android.support:design:22.2.0'
And then add the FloatingActionButton to your layout file:
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="#dimen/fab_margin"
android:src="#drawable/ic_done" />
Example project from Chris Banes: https://github.com/chrisbanes/cheesesquare.
I created an open-source library called FloatingActionButton. It's a Google+ like floating action button which reacts on the list view scrolling events. Becomes visible when the list view is scrolled up and invisible when scrolled down. API level 14+.
Here is one aditional free Floating Action Button library for Android
It has many customizations and requires SDK version 9 and higher
Full Demo Video
dependencies {
compile 'com.scalified:fab:1.1.2'
}
Original post is here.
You can use this library, it works well from the Android 2.1, API level 7.
It's so easy to include it in your project:
build.gradle
dependencies {
compile 'com.shamanland:fab:0.0.6'
}
layout.xml
<com.shamanland.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/your_image"
/>
You can use this demo FloatingView. This demo work from API 11.
Here put all the parts necessary to implement by code. FloatingView by steps
Try this library, https://github.com/navasmdc/MaterialDesignLibrary
It can be easily to adapt to your project using Android Studio