I changed from the original ActionBar to the AppCompat Toolbar and setSupportActionBar(toolbar). When I am using getSupportActionBar() and setDisplayHomeAsUpEnabled(true) for the back arrow, the click never calls onOptionsItemSelected or any other listener method. Do I have to implement some special listener for it? Befor everything was working just fine. EDIT: Initialise the ActionBar: mToolbar = […]
I have a relatively simple Android app with one Activity showing a list of items and another showing details of a selected item. I start the list activity, which is my topmost activity (using FLAG_ACTIVITY_CLEAR_TOP to clear the login activity from which this is called) with: Intent intent = new Intent(this, ListInstancesActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); […]
I searched a lot but can not find a way, How can I set then title at center of ActionBar instead of left aligned. I used below code to set the title at center : ViewGroup decorView= (ViewGroup) this.getWindow().getDecorView(); LinearLayout root= (LinearLayout) decorView.getChildAt(0); FrameLayout titleContainer= (FrameLayout) root.getChildAt(0); TextView title= (TextView) titleContainer.getChildAt(0); title.setGravity(Gravity.CENTER); But it gives […]
While updating my apps to Kitkat, I just wanted to give them a gorgeous look on KitKat using the Translucent property: Translucent system bars You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so […]
From my observation from Gmail and TED app the behavior of up navigation it will navigate to parent with the same state (scroll position) not like what Google say in their doc Implement Up Navigation which like create a parent intent and start it. I implement the code from Android sample code and all state […]
Is there a way to render a view on top of the action bar? I want to create a small tip box that will point the user to an item in the action bar. I know that a Toast with a set view will be rendered above the action bar. Does anyone know how to […]
I’m having trouble changing androids action bar title color programmatically for v11 and up. I can get it done in xml but need to change it dynamically in code. How should I go about this? Thanks in advance.
with the help of these Android Docs.I am trying to do a action bar Back button.I get an Action Bar Back Button like these below image: Output: But My problem is After watching the Gallery images I press the action bar back button. Then it is not working.But it have to go back to previous […]
There is an ActionBar on each Android 4.0 application, and it got a title. I need to make this size less. But I don’t understand how I can do it, because ActionBar doesn’t provide public methods for it. Remark: I don’t want to use custom views.
I use ActionMode to select items in a grid. The problem is that I cannot recognize whether exactly the Done button is clicked. The only I can is to know that ActionMode is finished. But pressing Back finishes the ActionMode too. The desired behavior is to accept selection on Done click, and exit ActionMode on […]