How do I change the color of the split actionbar in code, and not in xml? My user can pick the color of the actionbar, and I would like it so they could also change the color of the split action bar (the actionbar that appears at the bottom of the screen).
I'm implementing splitActionBar using android:uiOptions="splitActionBarWhenNarrow"
in android manifest
so far I'm trying this, but it's not working
final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android");
final View splitActionBar = findViewById(splitBarId);
if (splitActionBar != null) {
splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors)));
}
}
Use this to change the split actionbar color
getActionBar().setSplitBackgroundDrawable(new ColorDrawable(Color.parseColor("#33B5E5")));
Or use this if you're using support actionbar
getSupportActionBar().setSplitBackgroundDrawable(new ColorDrawable(Color.parseColor("#33B5E5")));