android - Spinner in ActionBar doesn't appear -


I like the spinner and now I want the spinner to be the actionbase (instead of a spinner in the action spinner) , But it does not appear there: (

  spinner spinner = spinner) SearchVibIID (RID.planetspinner); Arrayedtter & lieutenant; Square queens & gt; Adapter = Arrayadaptor.Creatofrom Resource (this, R.RA.PLANETS_ARE, ANDROID ROULET. SIMPAL_SPERIR_ITAME); Adapter.Scentropodownous Resource (Android R.Let Simple_ Spinner_DropDown_Item); Spinner eset adapter (adapter); ActionBar SetCustomView (spinner);   

and here .xml

   
Spinner Android: id = "@ + ID / Planospinner" Android: layout_width = "fill_parent" Android: Layout_heat = "wrap-content" /> gt; & lt; / LinearLayout & gt;

Please do not suggest using the Actionbar dropdown list, I can not use it because I'm already using the ActionBar tab Android does not allow them to be used at the same time Any help would be appreciated

Your code is missing this line:

  actionBar.setDisplayShowCustomEnabled (true);   

For reference See.


Update:

Why is there a blank frame layout in your layout that is at all width and height? Remove it And also remove LinearLayout , just use it as a layout:

   ;   

And then type something like this and everything is fine:

  actionBar.setCustomView (R.layout.your_layout_with_the_spinner); ActionBar.setDisplayShowCustomEnabled (true); Spinner Spinner = (Spinner) Find VVBID (R.D.plnetspinner); ArrayAdapter & LT; CharSequence & gt; Adapter = Arrayadaptor.Creatofrom Resource (this, R.RA.Planets_Are, AndroidR.Let.Simple_spinner_item); Adapter.setDropDownViewResource (android.R.layout.simple_spinner_dropdown_item); Spinner.setAdapter (adapter);    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -