Style in Progress bar:
private void progressBarFn() {
new Thread(new Runnable() {
public void run() {
while (progressStatus < 100) {
handler.post(new Runnable() {
public void run() {
progressColor1();
progressBar.setProgress(progressStatus);
progPercen.setText(String.valueOf(progressStatus + "%"));
}
});
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}private void progressColor1() {
if (progressStatus >= 0 && progressStatus <= 29) {
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar2)); // Color of Orange
} else if (progressStatus >= 30 && progressStatus <= 69) {
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar3));// Color of Yellow
} else if (progressStatus >= 70 && progressStatus <= 99) {
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar4));// Color of Green
} else if (progressStatus >= 100) {
progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar5));// Color of Red
}
}
==========================================
Snack Bar
Snackbar snackbar = Snackbar.make(coordinatorLayout, "Problem in internet connection!", Snackbar.LENGTH_LONG) .setAction("RETRY", new View.OnClickListener() {
@Override
public void onClick(View view) { @Override
}
});
snackbar.setActionTextColor(getResources().getColor(R.color.red));
View sbView = snackbar.getView();
TextView textView = (TextView)sbView.findViewById
(android.support.design.R.id.snackbar_text);
textView.setTextColor(Color.WHITE);
snackbar.show();
=======================================================
Comments
Post a Comment