Can I turn off the ActionBar navigation list control?

I am using the navigation control in ActionBar to provide a drop down list. I would like to disable the selection of the drop-down list under certain circumstances.

My layout for the closed view of the counter adapter has a TextView wrapped in LinearLayout . The best I came up with is to override getView in my spinner adapter and make both LinearLayout and TextView inaccessible and disabled. This affects the selection of text, but you can select it.

Change I appreciate that I can hide the list, but that’s not what I want to do. In addition, I returned false in methods that check if one or all elements are enabled, but this does not work.

Trying to get this to work with Honeycomb on Xoom. Thank you in advance. Peter.

+3
android android-3.0-honeycomb
Jun 23 '11 at 8:00
source share
2 answers

If you want to prevent something from being selected in the list navigation mode, call setNavigationMode(NAVIGATION_MODE_STANDARD) and completely get rid of it until you are ready to use it again.

If you want to prevent certain items from being selected in list navigation mode, suggest SpinnerAdapter areAllItemsEnabled() areAllItemsEnabled() to return false and implement isItemEnabled() to return true or false as needed - I have not tried this, but theoretically it should work.

+11
Jun 23 '11 at 12:52
source share

You can create a custom view in your ActionBar as follows:

  ViewGroup customFilterBrowse = (ViewGroup) getLayoutInflater().inflate(R.layout.component_cancellable_progressbar, null); ActionBar actionBar = getActionBar(); actionBar.setCustomView(customFilterBrowse); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM); 

You can make your own representation the way you want (you can create a Spinner component that you, for example, disable in certain circumstances).

NTN

0
Aug 22 2018-11-11T00:
source share



All Articles