I'm trying to add a progress bar to my actionBar. I'm talking about the spinning circle. I did a request and tried to set is vissible, but nothing happens.
I have read many likely questions but is still couldn't figure out what i'm doing wrong.
My code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);//Above setContentView, very important
setContentView(R.layout.activity_main);
//...other stuff
}
In an other method which i don't call in on create.(It's an onClick method)
public void plus(View view){
setProgressBarIndeterminateVisibility(true);//Nothing happens
//...other stuff
}
I do not understand what's wrong, please help me.
NOTE: I never set it to false
Edit:
I tried mmlooloo second part, but absolutly noting happend. Not even part 3. So I tried part 4, but i gave me an exception.
"This Activity already has an action bar supplied by the window decor.
Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to
false in your theme to use a Toolbar instead."
I removed the Window.FEATURE_ACTION_BAR request, but it gave me the same exception.
I don't think i need to set windowActionBar to false, but I did and it still gave me the same exception.
Any other options?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…