Android draw a rectangle to navigation drawer menu item - android

I have to create a navigation drawer with a custom menu item.
I know I can create a ListView with custom item layout or use third-party libs etc., but I feel that would be an overkill for this little modification, because the 'default' working method is almost perfect for me.
I have to draw a little rectangle with different color to every menu item.
Can I achieve this with default components somehow?

Finally I've successfully solved the problem by using Mike Penz's MaterialDrawer library with custom drawer item and custom item layout.

Related

How do I implement a custom bottomnavigation like this

I need to implement a custom bottomnavigation like in the image. My peculiar issue is that when a menu item from the bottomNav is clicked the bottomnav has to reposition the text above and add an image of a dot below it like as shown in the image.
This means that small solutions to selected state like using a custom selector cannot solve this.
Is there a way to inflate a selected layout to show how the bottomNav should look when selected? What methods or other ways do you suggest I tackle this issue?
Try This Git library It's not 100% same as want, but good
https://github.com/iammert/ReadableBottomBar
Ah! Totally forgot to answer this after I solved it.
I was initially showing an Icon and label combination in the bottomnavigation. I was looking for a way to hide the icon on click and show a dot on the bottom which was the wrong way to go and would be complex.
I ended up adding the icon and label as a group drawable vector instead of individually. So for each bottomnavigation option, I had a drawable selector xml with state for selected and unselected.

Bottom Menu bar with submenu

Im using the BottomNavigationViewEx library to display a Bottom Menu Bar in my android app, the library works well and fixes many of the shortcomings of the standard BottomNavigationView.
The problem comes when as per requirements I need to show 7 options in the menu, with 4 options being the direct access to their respective functionality and a "More" option, that should show a submenu with 3 more options (similar to a toolbar with items with property showAsAction="never")
Since the library does not admit more than 5 items and does not support submenus either I've been trying to implement a solution to no avail. Is there a way to implement this or any other bottom menu library that I could use that implements submenus (or lets me extend it to create a submenu)?
#Jeav148, you can take help from androidhive tab tutorial.
https://www.androidhive.info/2015/09/android-material-design-working-with-tabs/
From this tutorial you can check the scrollable tabs, so you'll be able to add tabs as much menu items you want.
Just you need to use the tablayout inside RelativeLayout with property AlignParentBottom = "true" to show the tabs at bottom.
Even though Adil's answer could have worked, I didn't go for it since it could create other problems. So I ended up making a Popup Menu anchored to the last menu item in the BottomNavigationView

Adding a shadow to Sliding Drawer

I knew Sliding Drawer is deprecated. So I imported Sliding Drawer Class to my own package and I customized it to satisfy my requirements. Now the scenario is, I want to add a shadow that wraps both handle and content of the sliding drawer. If I add shadow for handle and content separately (by giving image with shadow as background for both handle and content),then the shadow makes a gap between the handle and content. That is not my requirement. Please guide me through this.
navigationDrawer.setDrawerShadow(R.drawable.someDrawable,GravityCompat.Start);
You will need to use a drawable for the shadow. Use the setDrawerShadow method on the navigationDrawer object.

Custom Navigation Drawer

as I pursue my study on android app development I came across this app from apple and I was wondering if, is there a way to imitate the navigation drawer in this screen shot?!
See it's an expandable navigation drawer. a list view with some items that are expandable. Is there an actual way to imitate this on android?
Thank you very much again for all of your help.
You can recreate that drawer.
You can use the ExpandableListView within the Navigation Drawer. And of course you'll have to create your own parent and child item layouts for the listview. As well as appropriate styling. You can use tutorials to do this, first create the navigation drawer, then create the expandablelistview and put it within the navaigation drawer layout.
I'd also like to note on that screen shot, the drawer is incorrect. It should slide out below the action bar, over-top of the activity (like in the link). It should not slide the entire application window to the right like how some apps do.
Use a Custom ListView for this, see here for that: How To Create A Custom Listview - Android Example
Also, you will have to create specialized buttons that have a different look than standard holo buttons, see here for that: How to create custom button in Android using XML Styles
Finally, I do not believe it is possible to directly clone the navigation drawer, as the app you showed doesn't have an open sourced app (as far as I know).

Android Actionbar PopupMenu with Custom Item Layouts

I am working on an Android application where I have to design a menu which will populate from the action bar, like this:
I have tried my best but was not able to produce it using the Android controls.
The solutions I have tried are:
With Actionbar, add a menu item with a group with selectable="all", that produces the layout I need but when I click a checkbox for selecting it, the whole menu hides and selection is not done, moreover the menu icon in actionbar does not have the bottom right white arrow.
Tried creating a custom ActionProvider and added the menu items using class's OnPrepareSubMenu method but had the same issue.
I just need a push in the right direction and I can do the rest, suggestions are more than welcome.
Thank you :)
Use popupWindow.
In that you can make any custom layout and set it as content of your popupwindow and also you can specify an ANCHOR in your case it would be
R.id.your_menu_item
set a listener and listen the changes.

Categories

Resources