The ActionBar shadow can be removed with themes and the windowContentOverlay
tag, but is it possible to dynamically remove and re-add it from code at runtime?
Same question here, which has not gotten any solving answers.
The ActionBar shadow can be removed with themes and the windowContentOverlay
tag, but is it possible to dynamically remove and re-add it from code at runtime?
Same question here, which has not gotten any solving answers.
After struggling a while, I was able to write a solution for API > 21:
private ActionBar actionBar;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle instance) {
// ...
actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
return view;
}
@Override
public void onResume() {
super.onResume();
if (actionBar != null) {
actionBar.setElevation(0);
}
}
@Override
public void onPause() {
super.onPause();
if (actionBar != null) {
actionBar.setElevation(getResources().getDimension(R.dimen.toolbar_elevation)); //8dp
}
}
Hope this answer can help you by somehow, although have some while you asked that :