Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

change button background drawable in code

if(v.getBackground().getConstantState().equals(getResources().getDrawable(R.drawable.bg_btn_black_outline).getConstantState()))
        {
            v.setBackgroundResource(R.drawable.bg_btn_black);
            s = ( (TextView) v ).getText().toString();
        } else {
            v.setBackgroundResource(R.drawable.bg_btn_black_outline);
        }
 
PREVIOUS NEXT
Tagged: #change #button #background #drawable #code
ADD COMMENT
Topic
Name
9+1 =