Android : Actionbar Icon disappearing in UI - android

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.

Related

App not working after changing Theme.MaterialComponents.DayNight.DarkActionBar to Theme.AppCompat.Light.NoActionBar

I watched a tutorial on how to create a custom Toolbar in Android Studio and I saw that I must change Theme.MaterialComponents.DayNight.DarkActionBar to Theme.AppCompat.Light.NoActionBar. I tried to do it and after running an app it showed only a splash screen and then it crashed. Please, someone, help me.
Theme.AppCompat.Light.NoActionBar, No action bar means tool bar cant be created.
Change NoActionBar to LightActionBar or anything else you prefer. then customise the tool bar as you wish to
Try that
    
Theme.Material3.DayNight.NoActionBar
Instead of Theme.MaterialComponents.DayNight.DarkActionBar

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.

Dynamically change actionbar color while using a navigation drawer

I'm working on a project where I need to change the actionbar color within a single activity multiple times according to the content. This is done using
bar.setBackgroundDrawable(colorDrawable);
WITH this line, a portion of the actionbar turns transparent/grey (base theme is #style/Theme.AppCompat.Light.DarkActionBar) as soon as the navigation drawer is opened.
WITHOUT it, the background stays solid as expected even when the navigation drawer is opened. However, this does not allow for diffrent colored pages.
I'm using the support actionbar from appcompat 7, but it can be reproduced with a Toolbar as well as on multiple android versions.
Any ideas WHY this happens? Have I just messed up or is this in fact a bug?
Any workarounds, apart from setting a fixed color for the actionbar?
Note the right area of the actionbar that has become grey/transparent after opening the navigation drawer
I solved it. Kind of...
Please post other solutions if you can improve on this, as it is not the cleanest solution.
Changing the above mentioned
bar.setBackgroundDrawable(colorDrawable);
to
bar.setBackgroundDrawable(new ColorDrawable(((ColorDrawable) colorDrawable).getColor()));
solved the problem for me. This really should not have to be done though.

Android Sub Menu Changes Background Color

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.

Very top bar with battery life and wifi status not showing up

Sorry for the simple question but I cant figure out whats going on with this. The theme of my layout is set to NoTitleBar and the gui shows that slim bar where you pull notifications down from but when I run my app on my galaxy nexus its not there. It just shows white space where that bar is supposed to be. How do I make this bar with battery life and such show up. thanks
check your activity declared in mainfest file ..put your theme as no title bar in your activity in manifest file..if problem is not solve then put your code for better understanding

Categories

Resources