android-actionbar

How to display and set click event on Back Arrow on Toolbar?

时光总嘲笑我的痴心妄想 提交于 2019-12-28 03:46:07
问题 How can I set back arrow in Android toolbar and also apply click listener? 回答1: First make one toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@color/colorPrimary" local:theme="@style

How can I refresh the ActionBar when onPrepareOptionsMenu switched menu entries?

北城余情 提交于 2019-12-28 03:32:17
问题 Within my apps I often enable/disable menu entries and do make them visible from onPrepareOptionsMenu. Today I started to add the android:showAsAction menu attribute to some of my Android 2.x apps to show menu entries used most on the ActionBar. The ActionBar does not reflect the enable/disable and visibility immediately. I need to click on the menu dropdown on the right to see this change happen. Ok, I do understand that the menu fires onPrepareOptionsMenu. But what do I need to do to

Action bar Back button not working

纵饮孤独 提交于 2019-12-28 02:39:10
问题 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 page . Listed below are the codings. GalleryActivity.java: import android.app.ActionBar; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.NavUtils;

How can I change Action Bar actions dynamically?

风格不统一 提交于 2019-12-28 01:49:48
问题 I have an Activity with ActionBar and tab navigation. I am using the split mode, so the tabs are at the top and actions are in the bottom bar. How can I dynamically change the bottom actions? I need this because every tab has different actions. 回答1: Since the actions are populated by the activity's options menu you can use Activity#invalidateOptionsMenu() . This will dump the current menu and call your activity's onCreateOptionsMenu / onPrepareOptionsMenu methods again to rebuild it. If you

No App Icon on ActionBar

不打扰是莪最后的温柔 提交于 2019-12-27 11:50:44
问题 There are a lot of queries here about adding icons to ActionBar but none solved my problem. If you know a duplicate of this question, feel free to comment or close this question. I migrated my project to IntelliJ and I didn't encounter this problem with my previous IDE (Eclipse). PROBLEM: The app icon is not displayed in the ActionBar. I think it's supposed to be added by default that's why I can't add it through its XML Here's its XML <menu xmlns:android="http://schemas.android.com/apk/res

No App Icon on ActionBar

眉间皱痕 提交于 2019-12-27 11:46:51
问题 There are a lot of queries here about adding icons to ActionBar but none solved my problem. If you know a duplicate of this question, feel free to comment or close this question. I migrated my project to IntelliJ and I didn't encounter this problem with my previous IDE (Eclipse). PROBLEM: The app icon is not displayed in the ActionBar. I think it's supposed to be added by default that's why I can't add it through its XML Here's its XML <menu xmlns:android="http://schemas.android.com/apk/res

No App Icon on ActionBar

六眼飞鱼酱① 提交于 2019-12-27 11:45:06
问题 There are a lot of queries here about adding icons to ActionBar but none solved my problem. If you know a duplicate of this question, feel free to comment or close this question. I migrated my project to IntelliJ and I didn't encounter this problem with my previous IDE (Eclipse). PROBLEM: The app icon is not displayed in the ActionBar. I think it's supposed to be added by default that's why I can't add it through its XML Here's its XML <menu xmlns:android="http://schemas.android.com/apk/res

getActionBar returns null

蹲街弑〆低调 提交于 2019-12-27 11:06:54
问题 Calling getActionBar returns null . This has been frequently reported so I've made sure to include the solutions others have used: My minSdkVersion=11 , I do have a titlebar, and I'm calling getActionBar after setContentView . Also, my activity is not a child activity. setContentView(R.layout.main); // experiment with the ActionBar ActionBar actionBar = getActionBar(); actionBar.hide(); Device is a Samsung Galaxy Tab 10.1 running Android 3.2 Thanks in advance for any ideas or suggestions! 回答1

getActionBar returns null

纵然是瞬间 提交于 2019-12-27 11:05:25
问题 Calling getActionBar returns null . This has been frequently reported so I've made sure to include the solutions others have used: My minSdkVersion=11 , I do have a titlebar, and I'm calling getActionBar after setContentView . Also, my activity is not a child activity. setContentView(R.layout.main); // experiment with the ActionBar ActionBar actionBar = getActionBar(); actionBar.hide(); Device is a Samsung Galaxy Tab 10.1 running Android 3.2 Thanks in advance for any ideas or suggestions! 回答1

Remove icon/logo from action bar on android

↘锁芯ラ 提交于 2019-12-27 10:42:14
问题 I've been trying to find some way of removing the icon/logo from the action bar but the only thing I've found after an hour of searching SO, Android's documentation and Google is how to remove the title bar in whole. That is not what I want. Only want to remove the icon/logo from the title bar. Any one know how to accomplish this? Preferably I'd like to do this in XML . 回答1: If you've defined android:logo="..." in the <application> tag of your AndroidManifest.xml , then you need to use this