I am using FloatingActionButton and it works without issues. Though, I want to change its behavior. I want it to behave like an ImageButton. When I scroll down the layout, I want it to move with the other views and disappear off-screen. I do not want it to stay on top always.
I know there is an alternative solution where I need to copy the style of FloatingActionButton into an ImageView. Though, I wanted to know if it is possible to do what I want using FloatingActionButton only.
Thanks.
Taking from the Material IO documentation, a floating action button has the following usage:
A floating action button (FAB) performs the primary, or most common, action on a screen. It appears in front of all screen content, typically as a circular shape with an icon in its center. FABs come in three types: regular, mini, and extended.
But as you asking, you want to use it as simple view that scrolls with others on the screen. Thinking this way, you can set the most visible characteristic of a FAB less contextual, the elevation.
In your layout.xml file:
<FloatingActionButton
app:elevation="0dp"/>
Related
I'm a beginner on Android development and am trying to build my first app. I have an activity with a round target image and I'd like to make this image vanish at scroll down and display an another image instead that would snap to the toolBar (see the example images below).
I've researched this, but have only found information about using effects in apps where the image just vanishes. Perhaps, the Coordinator Layout could be useful here?
Initial state of my layout
After scrolling up, I want to change to a state like this.
To summarize, I have to :
- make my round Image go behind de ToolBar
- make the rectangular ImageView2 appear below the ToolBar
- Align my buttons (I guess it's about speed ? The one in the middle should go faster or something like that).
- Display new infos coming from below
You should surely use CoordinatorLayout. The point is that you should add custom behavior to your ImageView.
You can see an example here:
https://www.bignerdranch.com/blog/customizing-coordinatorlayouts-behavior/
I would like to make a similar design to my RecyclerView (or if it's not possible maybe a ListView can do that) like the one in the status bar (or Lock Screen) of Android Lollipop and up.
I am mainly interested in how they stack on top of each other when they no longer fit into the screen. And the way they slide up is they go each one behind the one above it.
Here are some images (they are stacked in the second screen): one, two.
I know how to use the RecyclerView with default scrolling behaviour and such but the one described above is very interesting. How is it possible?
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 developing an application for android that is already done for IOS, is not big problem.
the thing is that my boss want it to be exactly the same, but one of the menus is the problem, is like a slide menu but with zoom and a background image, anyone have any idea how can i do this, i already google it but no results :(, a library would help.
here is a picture with the menu for IOS.
I don't think if it would be an effective solution but you can use a RelativeLayout.
Put the selection part behind in a LinearLayout then put a framelayout front to contain list fragments. This way you shouldn't use an action bar to have absolutely same looking with iOs version.
When someone clicks open button apply an animation to your framelayout. scale it by %75 and move it 25% in y coordinate and move it %50 in x coordinate. When buttons in your LinearLayout apply a reverse animation to your FrameLayout. If swap button clicked change your fragment with new one. You can also aply a transaction animation to your fragments.
I hope you know how to handle this stuff. If no I can do my best to code an example.
EDIT:
Don't forget to set your flame layout unclickable when you move it to right side.
https://github.com/SpecialCyCi/AndroidResideMenu
I think I found your answer. I came across this in a list of libraries it is 3.8 on the list https://github.com/Trinea/android-open-project/tree/master/English%20Version
Cheers!
I would like to change the style of an Android widget button (specifically the corners) completely programmatically. Meaning, I would like to do it without any xml files at all. From my research I am coming to the conclusion that this is not posible. Is my conclusion correct or does someone know how it might be done?
You should look at the inherited methods from TextView and View of Button:
setPadding(int left, int top, int right, int bottom)
to name one... you can also change the layoutparams of the button object, which gives you access to all the xml attributes normally accessible. In general, you can do everything programmatically that you can do in the xml.
If that isn't enough, you can extend the Button class and override the onDraw method to change how android draws your button
EDIT:
Maybe you can add an xml theme much like this thread suggests: How to programmatically setting style attribute in a view
and then in it set
and add the theme programmatically to the button?
I haven't done much work with themes, so I can't attest to whether this will definitely work
Why do you think this is the case? Taking one of your items as an example, here's a method to set padding.
For corners you can use a drawable with a shape with rounded corners. See the documentation for drawables. There are also many questions (with answers) on StackOverflow about this too. If you want to do it programmatically there is the RoundedRectShape.