android-actionbar

Enable/Disable Tab in ActionBar

非 Y 不嫁゛ 提交于 2019-12-09 17:41:28
问题 It's possible to enable/disable Tabs in ActionBar? With TabHost this is not a problem.. I do: tabHost.getTabWidget().getChildAt(3).setVisibility(true); and all works.. but if i want to do the same thing with Tabs in ActionBar?? In Tab class don't exist setEnable(); ActionBar bar = getActionBar(); Tab tab = bar.newTab(); tab.setText("Test"); tab.setEnable(false); /*DON'T EXIST!!*/ How can I do?? 回答1: You could use the removeTab( ActionBar.Tab tab )-method of ActionBar : bar.removeTab( tab );

dynamically enable/disable hide/unhide Android ActionBar action icon

守給你的承諾、 提交于 2019-12-09 16:20:06
问题 I am developing an Android application that employs a standard ActionBar. on a certain screen i have a Filter icon that is conditionally required, depending on characteristics of the data being displayed, e.g. some data is filterable Others not. i cannot find any methods on actionbar that look likely candidates for programmaticaly hiding an actionbar action icon. how can i enable/disable an actionbar action icon? Or how can i hide/unhide an actionbar action icon? 回答1: Have a look at this, it

Intercepting ActionBar Home button in Fragment

大憨熊 提交于 2019-12-09 13:28:24
问题 I can successfully intercept the ActionBar home button from my NavigationDrawerFragment , which is added to my MainActivity , like so: @Override public boolean onOptionsItemSelected(MenuItem item) { if (!loggedIn() && item.getItemId() == android.R.id.home) { login(); return true; } return super.onOptionsItemSelected(item); } However, in my ComposeActivity with ComposeFragment this does not work. onOptionsItemSelected is not called on the fragment. I have debugged the code and the issue seems

Styling action item background ActionBarSherlock

拥有回忆 提交于 2019-12-09 13:24:52
问题 I've been trying to create my own action item, but it has benn impossible for me. What I'm tryind to do, is creating a custom action item layout (color background for example), something like "Thumbs" action bar. I only want to change action items only for one of my activities. I've been playing with android:icon and android:actionLayout property for action menu items.. but I got nothing. Actually, I've seen another threads in StackOverflow, but it didn't help me ... Building ActionMode with

Is it possible to add a timer to the actionbar on android?

匆匆过客 提交于 2019-12-09 11:37:13
问题 I'd like a simple mm:ss timer to be displayed on my actionbar, be able to pick the number of minutes to start counting down from and then call a method once it's at 0. Is this possible and how? Thank you 回答1: I've managed to do that by adding a TextView to the Action Bar as an Action View in the menu, then updating it at regular intervals using a CountDownTimer . (Tested on an Android 3.0 emulator, an Android 4.3 emulator and a real device running Android 4.3). Here's the XML for the menu

Getting screen coordinate of action bar menu item for creating introduction screen

我的未来我决定 提交于 2019-12-09 10:44:53
问题 I was wondering, if there is any possibility of getting the screen coordinates of an action bar menu item? As I would like to create an introduction screen, to draw an arrow pointing to the desired action bar menu item, so that the user knows where to start. 回答1: Here's how I did it: @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId().equals(R.id.my_menu_item)) { View menuView = findViewById(R.id.menu_item_search); int[] location = new int[2]; menuView

How to make the overflow popup menu avoid obstructing the action bar?

痞子三分冷 提交于 2019-12-09 09:33:54
问题 Background On my app, when I've updated to the new support library and also tried on Lollipop, I've noticed a weird issue: when clicking on the overflow button of the action bar (or even the new Toolbar class) will show the popup menu on top of the action bar, hiding other action items, as such: Here, the action items that got hidden are uninstallation and sharing. The problem I've tried to avoid this issue, by ovverriding the style of the overflow menu, but nothing has helped. Not only that,

Why is the up button present without setDisplayHomeAsUpEnabled()?

孤者浪人 提交于 2019-12-09 09:23:44
问题 According to Google's document, getActionBar().setDisplayHomeAsUpEnabled(true) is needed to show the up button. I created a bare-bone activity using the wizard in Eclipse and specified its parent activity. I could not find any getActionBar().setDisplayHomeAsUpEnabled(true) in the automatically generated code, but the up button is present when this activity is started and it works as expected. Could anyone shed some light on this? public class FooActivity extends ActionBarActivity { @Override

ActionBarSherlock (ABS): how to customize the text of action mode close item?

ぃ、小莉子 提交于 2019-12-09 08:49:22
问题 I'm using ABS vers. 4 and I need to simply change the default "Done" text that is displayed besides the action mode close icon, but I really can't figure out how to do it. I think that text needs to be customizable for at least two good reasons: "Done" is not appropriate for all contexts (e.g. "Cancel" could be more appropriate, and I've seen some apps, such as the "My Files" app on Galaxy Tab, use it) "Done" needs to be localized according to the user's language Is it possible to do

Change Elevation of ActionBar by theme

烈酒焚心 提交于 2019-12-09 05:10:57
问题 I want to remove the shadow below the ActionBar. I know that I need to change the elevation to 0dp, but I want to do it in the theme. For Android 4.4- I use : <item name="android:windowContentOverlay">@null</item> But is it possible for Android 5.0 ? 回答1: As shown by Antonio Jose, here is an answer : Remove shadow below actionbar For Android 5.0, if you want to set it directly into a style use: <item name="android:elevation">0dp</item> and for Support library compatibility use: <item name=