Android Sub Menu Changes Background Color - android

I have an android application that I want to add a sub menu for. The background of the application is the default which is black. All of the text on the app is white which I also think is the default. So I added in the sub menu but when I click on the sub menu the background turns to white but the text doesn't turn to black.
Any idea why the default sub menu behavior isn't working correctly? I'm hoping not to have to create styles and all that and the solution will be fairly simple.

Figured this out. This was due to me using titleCondensed instead of just using title. For some reason on sub menus it needs to use title but on the regular menu it works fine. Programming mistake by me.

Related

Navigation Drawer Toggle Icon without toolbar

So I'm basically a total beginner in things of app programming.
I started with the "Navigation Drawer Activity" from Android studio and my problem is, I want the nav drawer toggle icon (top left corner) and the "3 dotted icon" (top right corner), but I don't want it in a toolbar.
My question is, should I remove the toolbar and keep the Icons (if so, how could I do that) or should I make the toolbar fullscreen (don't know how to remove the appname)?
Or is there any better way? Like starting from scratch and placing the icons where I want?
Thanks in advance!
What you see as "nav drawer toggle icon" is actually an ActionBarDrawerToggle object and as its name suggests it can only reside in a Toolbar.
The "3 dotted icon" is the toolbar's menu button. You can create a new button with the same icon and use it to popup a menu but it's not that simple.
Remember that the Toolbar is a container and you can customize it the way you want, so my advice is to use it because the other option is a lot harder.
You can set:
in xml
android:elevation="0dp"
or
app:elevation="0dp"
or bycode
getActionBar().setElevation(0);
to remove any elevation of the toolbar.
A few years ago I did something similar to what I think your wanting to do. I made my app so that I had a navigation drawer and settings icon but styled it so that there was no actual visible bar. This gave the app a bit so generic feel and more of a modern look. Also made the drawer and settings menu feel more integrated with the app as a whole. Unfortunately this is a bit of an involved task. For one this in a way, in the sense that they are a "guideline" and that this goes against the idea of making the flow and feel of the app to be what the user is expecting in the traditional sense, goes against the Google Material Guidlines. And two the activity templates are good for learning and generic apps. If your trying to make something that customized is generally going to require you to create everything from scratch. Three, I find I have slight of trouble with the navigation drawer template the Android Studio provides. I'll use it to play around with ideas or to get a feel of how I want my app but if I'm ready to start coding my "production level" app I then start a new project with no activity and make everything myself. Now...
It sounds like what you want is a navigation drawer, which requires a toolbar, but don't want your app name to display. The three simplest solution here would be to go to the strings.xml and in there is a line like so.
<string name:"app_name">YourAppName</string>
Clear that line. (This may cause issues I haven't treated recently and am unable to atm)
There will still be a visible bar across the top though. So if that is not the desired effect, it would be simpler to create a new project with either a black activity or no activity. Google search Android how to create styles and themes and then Google search android navigation drawer with kotlin. Look for a tutorial that shows how to make a navigation drawer from either a blank activity or no activity. Then you will have to create your own style that either doesn't have a color or set the background transparency, of the appbar which is inside/apart of the toolbar, to 100%. I can't remember which because it's been a long time.
I hope this helps.
P.S. Thanks for this question it gives me a great idea for a blog post on my website "How to create a Navigation Drawer with no visible app bar in Kotlin". Once I get it made I'll add a link and can maybe edit my answer with some code detailing the style and theme modifications.

How to set only image as menu item in android

I have created options menu it has some attributes like android:I'd, android : title,android:icon etc how can I set a image as android option menu and also I want title of the item below the icon not beside the icon
You cannot do this easily and you should not. What you explain sounds more like Tabs to me, which you could use instead. With these you'll get text below the icon out of the box.

Android : Actionbar Icon disappearing in UI

I have put two icons from Android Icon Packager for action bar. The Info Action appears brightly while the next one, Refresh Action is not appearing. I use both as holo_dark. I tried switching just the refresh action, and it appears very very dimly.
I've try reading many many stuffs I seem to find nothing about this topic.
EDIT: I have solved this problem by deleting the whole refresh icon and then remove the line
android:icon="#drawable/ic_action_refresh"
in the XML. I then re-added the icon and it works like a charm. Voted both answer for caring about my question
Use Icon from your Android Package Opposite to Your Theme.
For eg: If you are using Holo_Dark Theme in your Application use Holo_White Icon Set for it.

How to change Menu item background color in android

In android 2.3 menu items are in black color and text in white color but i want change that color is possible?
Do you really want to change how the menu's look? I can't think of a single app that does that.
If you think you want to do this because your existing icons look bad, then you can create new versions of them and put them in /res/drawable-v9/ This will ensure that your new icons only show up in Gingerbread and higher.

Android menu item background

I want to change the menu item background beacuse I use black icons, but on some phones the default color of background is black or other dark color. I tried this solution and it's worked but there was a little problen with it:
I have ten items and that's why I have a "More" item to show other options, but if I choose the More item (which is got the custom background) and after that I press back button, the item will be in the default state, default colors. What is the solution? Thanks!
The style attribute for the menu background is android:panelFullBackground. It's not hackish like the other solution, so it's not as buggy.
Despite what the documentation says, it needs to be a resource (e.g. #android:color/black or #drawable/my_drawable), it will crash if you use a color value directly.
try to use android own menu icon like as setIcon(android.R.drawable.ic_menu_search)

Categories

Resources