Can't change the text color with Android Action Bar drop-down navigation

前端 未结 6 2026
傲寒
傲寒 2020-12-28 11:04

I\'m using Drop-down Navigation with my Action bar, and I can\'t get a sensible color for the corresponding text when using a dark action bar. The action bar itself is a da

6条回答
  •  孤独总比滥情好
    2020-12-28 11:14

    Please forgive my necromancy but this really bugged me today and the solution is actually quite quick and requires no custom adapters or styling.

    If you change the context in the SpinnerAdapter's constructor to use getActionBar().getThemedContext() rather than this it will show light text on a dark background that will match the Action Bar's style.

    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(getActionBar().getThemedContext(), R.array.action_list, android.R.layout.simple_spinner_dropdown_item);
    

提交回复
热议问题