Answers for "change color programmatically android"

0

change status bar color android programmatically

public void statuscolor(){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.parseColor(getPreferences().getString(Constant.SECONDARY_COLOR, Constant.SECONDARY_COLOR)));
        }
    }
Posted by: Guest on November-17-2020
0

how to change background tint color programmatically android

Drawable buttonDrawable = button.getBackground();
    buttonDrawable = DrawableCompat.wrap(buttonDrawable);
    //the color is a direct color int and not a color resource
    DrawableCompat.setTint(buttonDrawable, Color.RED);
    button.setBackground(buttonDrawable);
Posted by: Guest on February-05-2021
0

chnage hex color to int color in android

String white = "#ffffff";
int whiteInt = Color.parseColor(white);
Posted by: Guest on October-06-2020

Code answers related to "change color programmatically android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language