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

前端 未结 6 2029
傲寒
傲寒 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:35

    Java code

    SpinnerAdapter adapter = ArrayAdapter.createFromResource(this,
            R.array.actions,R.layout.dropdown_textcolor);
    
    // OnNavigationListener
    OnNavigationListener callback = new OnNavigationListener() {
    
        String[] items = getResources().getStringArray(R.array.actions); 
        public boolean onNavigationItemSelected(int position, long id) {
    
            // Do stuff when navigation item is selected
            Log.d("NavigationItemSelected", items[position]); // Debug
            return true;
        }
    
    };
    
    
    ActionBar actions = getSupportActionBar();
    actions.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actions.setDisplayShowTitleEnabled(false);
    
    actions.setListNavigationCallbacks(adapter, callback);
    

    Xml dropdown_textcolor.xml

    
    
    

提交回复
热议问题