Questions tagged [android-actionbar]
The ActionBar is Android's window feature that identifies the application and user location, and provides user actions and navigation modes.
8,890
questions
1
vote
0
answers
19
views
Material3 action bar doesn't allow to set background color programmatically
Trying to set a custom color for an certain Activity programmatically, but action bar doesn't react even when set setBackgroundDrawable(null). Any thoughts? Thanks
Style:
<style name="Theme....
1
vote
1
answer
39
views
How can I put an icon on the right of the action bar
I want to add an icon that is used to log out, but when I include the following code the icon is displayed on the left, and I am interested in it being displayed on the right, this is my code:
// Icon
...
0
votes
1
answer
53
views
StatusBar overlaps app's toolbar and the toolbar is gone on Android API 30+
I have a app's toolbar issue on Android API 30+. The device's status bar overlap my app's toolbar and the toolbar is gone. This problem does not occur on device with API below 30 (29, 28, 27, ...). I ...
0
votes
2
answers
56
views
action bar not showing in activity
I wrote a simple menu and added it to the action bar but I can't understand why they are not visible in my activity.
I'm using java and android studio, thanks.
Here is my code:
@Override
public ...
1
vote
2
answers
158
views
Can't hide ActionBar Android Studio Giraffe properly
I'm using Android Studio Giraffe | 2022.3.1 and I can't properly hide the ActionBar.
I saw both this and this related questions but they didn't help me.
Here is my MainActivity.kt file:
package com....
0
votes
1
answer
104
views
Android MenuProvider not working inside Fragment
I need to add a menu depending on the fragment the user is looking at.
I tried to use the new MenuProvider in the onViewCreated-Method of my Fragment:
override fun onViewCreated(view: View, ...
0
votes
0
answers
29
views
Why is this theme not being applied to this Android toolbar widget?
I am creating a Java Android application using Android Studio. I created a custom toolbar to use instead of the default action bar via setSupportActionBar. Everything is working except my custom theme ...
0
votes
0
answers
24
views
Adding a button to the support ActionBar
I currently have this setup for my application in which I have an action bar at the top of the screen with a "hamburger" icon in the top left that shows this navigation drawer.
I now want ...
0
votes
0
answers
21
views
How do I make an Android option menu button a drop target?
Is it possible to make this button a drop target for drag-and-drop? I'm open to any solutions.
0
votes
1
answer
437
views
Unable to start a Bottom Navigation View Activity from Main Activity in Android Studio
Unable to start a Bottom Navigation View Activity from Main Activity in Android Studio.
While working on a project on Android Studio(JAVA), I wanted to create a feed after login page. But when I try ...
0
votes
2
answers
339
views
Unable to replace CustomToolbar with ActionBar in Kotlin
I Created a Custom Toolbar and placed it in activity, but I got this error :
java.lang.IllegalStateException: Activity com.example.citiesdistance.feature.main.MainActivity@3a04806 does not have an ...
0
votes
1
answer
34
views
Back Navigation Issue (Nav Graph) Issue (android)
I am stuck in this issue of back navigation button for long while, I have tried different methods but still the problem is not resolved
Here is the IMAGE
This is my issue
So, I have a home ...
0
votes
1
answer
44
views
Unable to hide Action Bar while implementing Navigation Drawer
This is the full code of the xml.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/...
0
votes
0
answers
52
views
How to dynamically change status bar icon color for edge to edge?
When trying to develop your app to make it "edge to edge" and have your app content flow through the system bars, how do you deal with incompatible background colors and system icon colors?
...
0
votes
1
answer
45
views
Action Bar title and menu disappear when replacing fragment, after updating from targetSdkVersion 30 to 33
The application worked fine until I had to upgrade. Some libraries were updated also, but reverting the libraries back don't seem to fix it.
It seems to me that it is something related with the ...
0
votes
0
answers
23
views
How to add "hamburger" button to ActionBar in 2023?
I was trying to make the NavigationView open on click on the hamburger button in the ActionBar(Toolbar). But I got stuck already at the stage of displaying the icon of this hamburger, because Google ...
0
votes
1
answer
41
views
Can't center title in ActionBar
I need to center a title in ActionBar, so I've created custom ActionBar and function that sets custom title, but title is still not at the center.
class MainActivity: BaseActivity() {
override fun ...
0
votes
0
answers
50
views
My Navigation View Item Listener Does Not Respond?
I need a side drawer layout, with a navigation view that contains a few buttons, doing different things. The issue I am having is that when I go to add ANYTHING within my "...
0
votes
0
answers
62
views
How to change gravity om custom ActionBar in android studio
I am knew at kotlin and android staff, so need your help. I have created custom ActionBar on a specified activity and wanted to add text to it and a button to open drawerLayout. However, it is not ...
0
votes
1
answer
138
views
Cannot hide back button on action bar
My application have two top level fragment A and B controlled by a bottom navigation bar and fragment C can be navigated only from fragment B. I don't want the action bar on fragment C shows back ...
1
vote
0
answers
51
views
How to show ActionBar when exit full screen by swipe down?
mContext.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View....
0
votes
1
answer
17
views
How to set text on bottom of logo actionbar android
enter image description here
How to i print text on bottom of Action bar logo
<item android:title="Customer Inquiry"
android:id="@+id/customer_inquiry"
app:showAsAction=&...
0
votes
0
answers
16
views
TabSwipeActivity to work with ActionBar without ActionBarSherlock
I had actionbarsherlock in my app implemented. Now I want to get rid of it as Im increasing to API 21 and think its not required anymore.
I have an ActionBar on in a TabSwipeActivity and this is the ...
1
vote
0
answers
397
views
How to set status bar color to the same color than the app bar color?
I'm new to Android development. I use jetpack compose.
The TopAppBar color elevates as you scroll. That's fine, but I also want to elevate the status bar at the same time to the same color.
For ...
1
vote
1
answer
43
views
Android app running on emulator not on real device
Android emulator is working when running the application but on a real device the app gets an error from the action bar. I am using android bumble bee and the device is a Samsung s21
I already have ...
1
vote
1
answer
210
views
How to hide hamburger icon on a certain fragment?
Let's say I have 5 fragments (a,b,c,d,e) and I want to hide the hamburger icon on fragment a, but show the hamburger icon on fragment b,c,d,e. Is there a way to do this?
1
vote
0
answers
94
views
Toolbar menu item text doesn't align with icon
How can I align text with the icon? It is working fine if I remove parent property but it is being used by some other activity so I cannot remove it. I think I might have messed up somewhere in layout ...
0
votes
3
answers
180
views
App theme doesn't load correctly if the system theme is light and the app theme is dark
If the system theme is light and the app theme is dark, the actionbar items are dark when the app startup. (left picture)
When I reload the dark theme again from the in-app settings, the actionbar ...
2
votes
1
answer
66
views
How to show action bar when replace a fragment after hiding it on previous fragment?
I have an actionbar on MainActivity level (mainActionBar) and an actionbar on fragment level (fragActionBar). I have 3 fragments (A,B,C). I want mainActionBar to be shown when I'm accessing fragment A ...
0
votes
1
answer
42
views
Why action bar didn't show up after calling the show Unit?
I have 2 formats of action bar, I want to hide home action bar when I am in detail page and want to hide detail action bar when I am in home page. When I start the app, it directs me to home page and ...
1
vote
0
answers
121
views
How do i add overflow menu on custom action bar?
I want use custom toolbar because of title and subtitles but I also want to add overflow menu and I did everything and my toolbar doesn't showing overflow menu what I'm suppose to do
Main Activity ...
1
vote
1
answer
148
views
Null reference on ActionBar when calling it via getActivity() within a fragment in android studio
In Android Studio, I am trying to call getActivity().getActionBar() to display the back button on the Action bar in a specific fragment only. Below is my code:
@Override
public View onCreateView(...
0
votes
3
answers
85
views
Up Navigation in android
When I'm pressing the back button on phone or the support action bar, it's exiting the application. How can I fix it to return to the main activity
In login code:
override fun onCreate(...
3
votes
3
answers
845
views
How to hide action bar properly?
I have an activity and a few fragments in it, and I have an action bar that I need to be visible all the time except for the case when I open MyTestFragment, so when I open this fragment I need my ...
3
votes
1
answer
441
views
How can I prevent options menu icons flickering in the action bar when switching between fragments?
I am trying to migrate from the deprecated setHasOptionsMenu()/onCreateOptionsMenu() methods to the new addMenuProvider()/onCreateMenu() methods in order to show an options menu from a fragment. Using ...
0
votes
1
answer
166
views
Hide action bar immediately when open android app
After research in goole, I can hide action bar but the current result is the action bar still show few seconds before open MainActivity. You can refer in the gif below.
My question is can we hide ...
1
vote
0
answers
600
views
How to hide Android System UI correctly
I have searched now for a while, but get no working solution to work in my Android app.
I've got an activity with several fragments. I want to hide the system UI (action and navigation bar) and also ...
0
votes
1
answer
96
views
How to add remove ads button in action bar in android studio?
So, basically, I want to add a Remove ads button in my action bar which would on click open a paid version of my app in the play store.
I have made the design pretty much but don't know how to ...
-1
votes
1
answer
2k
views
How to use the new ComponentActivity with ViewBinding and the other old AppCompatActivity components
According to this question, I tried to update my deprecated menus codes like setHasOptionsMenu , onCreateOptionsMenu and onOptionsItemSelected in my fragments and all app, but I should replace ...
6
votes
1
answer
292
views
Action Bar on Android is still showing despite using NoActionBar theme
I am using the theme Theme.MaterialComponents.DayNight.NoActionBar (docs) for my Android app.
I am also calling getActionBar().hide() in the MainActivity.
On nearly all my devices, the Action Bar is ...
1
vote
2
answers
194
views
My app does not skip to the starting destination unless touch the screen
I designed an Android app with Jetpack Compose. I did not change anything in themes.xml, though my app does not skip to the starting destination of my app. A screen appears and does not go away unless ...
1
vote
1
answer
64
views
How to Handle Switch Button When build on Actionbar Android Studio
Some items of the action bar item were to be shown in the some fragment (which is the switch button), if Switch Button state is changed, the same layout then goes forward and then comes back then it ...
0
votes
1
answer
41
views
Why action bar appears in AVD but not in Physical device?
I am building a bus ticket booking app. The action bar on top appears in my AVD, but it doesn't appear in my physical device.
The themes.xml file
<resources xmlns:tools="http://schemas....
0
votes
0
answers
170
views
Title overlaps with view in custom toolbar Android
Hey guys I am trying to set title in my custom toolbar. It's not working until I explicit through xml. I don't want to put a Textview in xml in toolbar. I tried this post and trying to set by code, it ...
1
vote
1
answer
313
views
Black space under action bar
I'm trying my to learn basic app design and already made some simple stuff.
Now I'm getting stuck on the following.
How to get rid of this blank space underneath the action bar?
I've tried to hide ...
0
votes
1
answer
243
views
Error when removing action bar in theme.material
I am new to developing mobile apps and I am using android studio. I tried to remove the action bar but every time I tried to change the theme to NoActionBar, the following error appear.
java.lang....
0
votes
1
answer
459
views
set action bar as transparent android
I've found a few people asked this question but none seemed to have a real answer..
Trying to set the action and status bar in android as transparent but ending up with this strange border between the ...
0
votes
1
answer
203
views
Searchview in centre and after focus it goes to app bar in android
Hey guys I am learning Searchview in android. I have searchview in centre and when I focus it will go to app bar just like chrome application.
And when focus it will go to app bar
I didn't find any ...
2
votes
1
answer
637
views
How to change a theme in Android Studio from NoActionBar to ActionBar
I started a project in Android Studio and apparently, the Theme was Theme.NameOfProject.NoActionBar.
This is causing a the following error :
java.lang.RuntimeException: Unable to start activity ...
0
votes
0
answers
72
views
How to know the best color for status bar as according to the action bar color
ok I have changed the action bar color and status bar color to the same but it doesn't looks good and I want to get a darker color for the toolbar to make it look like how a normal status bar looks ...