I need to create something similar to this. This may be duplicate, I'm not sure how to search for this. If you press plus it will extend more buttons
Best Regards
There is no longer a need for creating your own FAB nor using a third party library, it was included in AppCompat 22.
https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html
How to create a floating action button (FAB) in android, using AppCompat v21?
Related
I've been following this code example from Google about the Floating Action Button in the newest Android library http://developer.android.com/samples/FloatingActionButtonBasic/index.html
This works, as a Checkable button. However, I don't want it to be checkable, I just want to be able to click it and animate it as you'd expect (seems strange the Google example is for a checkable button when it seems like it'd be against their design principles, and others have had problems)
I'm reasonably new to Android, and so far my research has come up with a lot of external libraries, but I'm trying to keep it as native as possible
Is there an interface in Android Java that would allow me to essentially use this as a button? The FAB button example is Checkable and obviously the constructors and methods pertain to that.
#jmo : Please check Android Floating Action Button based on Material Design specification And NQH_FloatingActionButton For sample Purpose . I hope this link will help you http://android-developers.blogspot.in/2015/05/android-design-support-library.html
You should instead use FloatingActionButton, part of the official Android Design Support Library.
I'm creating my first Android App, and as part of it, I need to add new buttons after a click on another button.
Then I need to create() a button after a onClick() event on another button.
How to do it?
Things you should know:
I am using Android Studio to develop the app,
I have already imported these:
import android.view.*;
import android.widget.Button;
import android.widget.TextView;
And I'd like to know where to get the whole Library list for android, or better, I'd like you to say what's your best android library to develop on such these things, I need to find and get experienced on a library so I'll need suggestions!
Thanks a lot in advance :)
P.S. Just typed those create() and onClick() to make it clear that I was talking about methods, but not that both of 'em are real ones or the ones I'll need ;)
P.P.S. I don't know how many buttons will be ther becuase I do NOT choose that, the user does, it's somethig like: I want to create a new thing, then I press the button '+' and create a new button (the new thing), for this reason, the amount of buttons isn't known, that's why I can't use the visibility trick, but yeah I first thought about that aswell!
rockfight's answer is correct, but I would recommend you to use the button in your layout with android:visibility="gone" and then show it when the user taps on the first button using button2.setVisibility(View.Visible).
It's always easier to create your layouts and views in xml instead of code.
Personally, I'm using support-v4 library, recyclerview, recently-released design library and some of the Google Play Services libraries.
EDIT: if you're going to add a lot of buttons, and you don't know how many, I'd recommend you to use ListView or RecyclerView. I personally prefer RecyclerView, but it might be more difficult to set up. Anyway, you'll be adding items to your list. That items are basically buttons, so your item layout would look like this:
item_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is a new button!"
android:layout_margin="16dp"
android:gravity="center_vertical|center_horizontal"
android:elevation="2dp"
android:translationZ="6dp" />
<!-- Material Design. See http://www.google.com/design/spec/what-is-material/elevation-shadows.html#elevation-shadows-elevation-android- -->
<!-- The attributes you need...... -->
That's all. You don't have to mess with ugly code. If you want to get an idea of the advantages of RecyclerView, see http://antonioleiva.com/recyclerview/.
Create a button object
Button myButton = new Button(this);
Then add button to your layout
LinearLayout layout = (LinearLayout) findViewById(R.id.my_layout);
layout.addView(myButton);
I am not sure what library are you talking about. To learn about android go to android developer website and click search button and search what you want to know. You will get all libraries there.
You do not need libraries for making onClick methods. When you have your button, set onClick method like this: button.setOnClickListener(new onClickListener...) if you press Ctrl+Space you will get possible choices of what to choose.
How many buttons do you wish to add programmatically? Maybe it would be better if you create buttons in xml and use Visibility.GONE and Visibility.VISIBLE if there are not many buttons and you know the end number of them.
How I can create some thing like this? Has it any specific name or view? Like red cycle image in below link:
You can create that view using a ListView like its explained there: https://developer.android.com/training/material/lists-cards.html.
You can create the floating button using an oval shape with an image inside and set some elevation. Click here for more info How to create a floating action button (FAB) in android, using AppCompat v21?
Have a look at general Android Material Design Guidelines to get some additional insight for these kind of ui. https://developer.android.com/design/material/index.html
This can be useful for you. I made a "dummy" Gmail UI for show a material activity transition. https://github.com/coyarzun89/FabTransitionActivity
I am trying to build an app using the new material design specs.
I am currently trying to get a cusdtom FAB layout working, similar to the one in the new Inbox app.
I have one main button, which when clicked, expands to several smaller ones.
However i want to add a textview to the left of the smaller buttons, like the inbox app.
I cant seem to find a way of doing this.
The floating action button i am using is based off this library, but with a few modifications https://github.com/futuresimple/android-floating-action-button/blob/master/README.md
If someone could suggest a way of doing this, it would be much appreciated.
Thanks
Corey :)
I'm working on a checkbook app, and I'd like to use a small widget like a TimePickerDialog or DatePickerDialog but one that acts like a keypad so the user can enter an account or transaction balance. I know I can use an EditText but I would like to be able to implement a keypad.
Does Android have any predefined UI elements to support this? I have tried to find some, but without luck. I did find an interesting article to implement my own using a GridLayout, but wondered if someone was aware of any Android classes that could already do this.
The GridLayout method: http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout--mobile-8677
If you specify android:inputType="numberDecimal" in the XML for your EditText, you'll get a keypad. If you decide that you need a more specialized keyboard, there's a very good tutorial here.
Some tips:
Read this tutorial: Creating an Input Method
Clone this repo: LatinIME