I want to get the Material3 Bottom NavigationBar height using code
I searched and couldn't find how, i had a workaround of tracing the official code to aprivate and internal obeject of value 80.dp. But i feel using 80.dp in my code might not be the best approach, is there any better way...?
I went through many questions regarding making bottom bar but my my question is a bit different.I want to make this.
bottom menu:
Now the thing is, the menu is not static.It's items can vary depending upon user's choice.So, I have to make it dynamic. What's the best approach to achieve this?
Also, I'm not sure how do I make that curved outline at the center item.I'm thinking that I should do it programmatically.Any suggestions are welcome.Even better if you can share code.
Use this to create Navigation bar, it will surly create view that you show us in image.
https://github.com/armcha/Space-Navigation-View
Bottom menu is now an official navigation view according to the official documentation but as far as I know, there is no native component available yet to implement that.
In my opinion, your best bet is to try customizing the following library created by Iiro Krankka (http://github.com/roughike):
BottomBar
I want to do in my app a View that I can swipe from the bottom of the window (Images below explain it better).
I want the view to stop at certain point. The view must allow to swipe/drag it to the bottom again. Any idea or tip of how can I do that?
I think you are in search of a ViewDragHelper:
API doc:
https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.html
How to use. This answer links to a sample project to show you how as well:
ViewDragHelper: how to use it?
Dragging best practices:
http://developer.android.com/training/gestures/scale.html
You can use the new material design pattern called Bottom Sheets.
They do the exact thing that you want. They also support custom layouts for the view.
Material Design - Component - Bottom Sheets
my app is using using Sherlock action bar.
my designer gave me a new design.
the app logo need to be in the middle
2 action items to the left and 2 actionitems to the right of the logo
the app logo height is 1.5 the size of the actionbar (it suppose to be a little overflow)
is it possible to create a custom layout for the actionbar to implement this desing ?
or should i remove my actionbar and implement the design my own ?
if item #3 will be optional , does it changes your answers ?
Thanks
I'm sorry, but kick your designer in the...
He doesn't get Android at all and shouldn't design for Android. Either it's an ActionBar and then you should treat is as such and you (or your designer) should follow the common pattern on Android, or it is not.
If it is no ActionBar, please do not use an ActionBar (no matter which library) and create a custom design that deviates enough from an ActionBar so as not to confuse users!
Please forward your designer, and your manager to Android design patterns site at http://developer.android.com/design/patterns/actionbar.html . Also tell them that if they want Google to ever feature them, they pretty much have to adhere to these. With all failed use full screen layout and create a custom control on the top
I agree with other answers: that's not an action bar as defined by Android guidelines.
I'll just add that in case you can't go against the design decisions made (yeah, real-world projects sometimes suck and as a programmer you'll have to do what the client asks).
Go with your own implementation. I suggest simply creating a fragment with the appropriate listener interface (a common Android pattern, let the activity implement the interface, set the fragment's listener in onAttach).
If you want to implement this (and I pretty much agree with the other posters, that this is non-standard, and probably shouldn't be done).
You won't be able to create this style ActionBar with the standard APIs (or ActionBarSherlock for that matter) - since your UI is non-standard
You could create a RelativeLayout, with your icon in the center (centerInParent="true"). Then in the same layout, you could create a background, with width set to "fill_parent", and the height to 2/3 the size of your center icon (calculating this value in DP).
Then you can create ImageButtons for your 2 ActionItems to the left and to the right, then just put them in your layout relative to the center icon.
Bottom line, you probably should re-think your UI, to make this more standard to the design patterns specified by Android. If you still want to do it the way your designer asks, you will need to do a custom layout (using a RelativeLayout as I suggested is one way to accomplish the UI you are looking for).
You could create a RelativeLayout, with your icon in the center
centerInParent="true"
Then in the same layout, you could create a background, with width set to fill_parent, and the height to 2/3 the size of your center icon (calculating this value in DP).
I have used an Android application recently that has an interesting UI pattern in it. I have made two screenshots to show you what I'm talking about:
Initial State (look at the blue rectangle on the right of the screen):
After clicking on that blue rectangle, it slides smoothly to the left, which results in the following screen:
My question is simple, how do you think this could be achieved? Also, what's the name of this pattern? A sliding pane?
This is called sliding drawer in the android vocabulary.
You can find is as an ui component.
To obtain the same result you would actually need to change the default handle to a blue one (from an image a priori).
Some links on the topic:
official documentation
A good example on how to customize it