-
Star
(174)
You must be signed in to star a gist -
Fork
(47)
You must be signed in to fork a gist
-
-
Save Jogan/9def6110edf3247825c9 to your computer and use it in GitHub Desktop.
FloatingActionButton fabButton = new FloatingActionButton.Builder(this) | |
.withDrawable(getResources().getDrawable(R.drawable.ic_action_add)) | |
.withButtonColor(Color.WHITE) | |
.withGravity(Gravity.BOTTOM | Gravity.RIGHT) | |
.withMargins(0, 0, 16, 16) | |
.create(); |
how can i set an OnClickListener?
Hey i import these code in my sample project but it didn't work on Pre-Lollipop device, Please tell me how i able to see these button on devices below Lollipop...?
Please reply me ASAP
@MatBenetti the same way you would set an OnClickListener on any other view. fabButton.setOnClickListener
I got the button working. How do you add functionalities like adding things that will appear once clicked?
fabButton.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, tabs.class);
startActivity(i);
}
});
i'mm having a problem with FAB overlapping my toolbar and its items
Hi! How i can add this fab button in layout/activity_simple.xml file?
Very nice and easy to use especially in Eclipse.
Where is the location to put this code.. please help m just a novice...
@shahbaz-man how I can change the color dynamically
This code is awsom , simple and helping.. thanks @Jogan ,
Just need how to add icon , my fab is simple white .
builder cannot be resolved
@Jogan, you are the boss!!! thanks so much, so easy to use and light weight. @faisal find below a code snip that haddles ur request.
FloatingActionButton read = new FloatingActionButton.Builder(this)
.withDrawable(getResources().getDrawable(R.drawable.ic_read))
.withButtonColor(Color.YELLOW)
.withGravity(Gravity.BOTTOM | Gravity.RIGHT)
.withMargins(0, 0, 16, 145).create();
USE THE DESIGN SUPPORT LIBRARY - NOT THIS ANYMORE
Too good and simple code thanks a lot..
Nice code, question how can I bring up the menu.xml on onClick?
how to start action button when i click
awsome bosss !!!
how to add another button after clicking on this button
i need to add more button.
Thank you so much for this code.. @Jogan
Your code is very much helpful for us. Thanks 👍
thank you from mw. it's very helpful cause i need to create app project mobile offline.
Upon adding a FAB using your technique I see a thin translucent ring around the actual image. I tried removing the margins and shadowlayer but it didn't work. Could you suggest how this can be removed?