set Underline Color for EditText - Android User Interface

Android examples for User Interface:EditText

Description

set Underline Color for EditText

Demo Code


//package com.java2s;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.widget.EditText;

public class Main {
    public static void setUnderlineColor(final EditText editText,
            final int color) {
        Drawable drawable = editText.getBackground();
        drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
    }// w  w w . ja v  a2  s . co m
}

Related Tutorials