How to change the default color in Android 5.1
and 6.
How to Make Layout look like API 19 in API 22,23?
I have been using this color to show progress bar color:
<color name="colorAccent">#EFAD04</color>
It's working in kitkat and lower versions but not in lollipop and Marshmallow
here's the progressBar.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.progress_bar);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP|| android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
progressBar = (ProgressBar) findViewById(R.id.progress_Launch);
progressBar.getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(Progressbar.this, R.color.colorAccent), PorterDuff.Mode.SRC_IN);
}else {
progressBar.getIndeterminateDrawable().setColorFilter(getResources().getColor( R.color.colorAccent), PorterDuff.Mode.SRC_IN);
}
progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
handler = new Handler();
Thread thread = new Thread(){
@Override
public void run() {
try{
sleep(100);
}catch(InterruptedException e){
e.printStackTrace();
}
}
};
thread.start();
}
}
in API level 19 or less, progress bar is like:
And in Marshmallow Nexus 7, it's like:
I have changed the build versions also in activity.