Widget - Button Color State

Anmol dwivedi
0

android.graphics.drawable.GradientDrawable bg = new android.graphics.drawable.GradientDrawable();

bg.setColor(new android.content.res.ColorStateList(new int[][] {{-android.R.attr.state_pressed}, {android.R.attr.state_pressed}},new int[] {Color.parseColor("#901020"), Color.parseColor("#40109020")}));
bg.setShape(1);
bg.setCornerRadius(10);
bg.setStroke(2, new android.content.res.ColorStateList(new int[][] {{-android.R.attr.state_pressed}, {android.R.attr.state_pressed}}, new int[] {Color.parseColor("#505050"), Color.parseColor("#502010")}));

button1.setBackground(bg);

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)
Our website uses cookies to enhance your experience. Learn More
Accept !