1. Download our Official Android App: Forums for Android!

Apps partially changing edit text bottom line color

Discussion in 'Android Development' started by androidworld786, Apr 13, 2016.

  1. androidworld786

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Apr 13, 2016

    Apr 13, 2016
    2
    0
    5
    Male
    I need to partially change the edit text line color as the user types the input only for that length of text the line below should change the color.

    I tried using text watcher and
    email.getBackground().setColorFilter(getResources().getColor(R.color.black), PorterDuff.Mode.SRC_IN);
    but that changes the color of complete line. Could someone please help me here ?
    I have been stuck on this for quite sometime.

    textWatcher = new TextWatcher() {
    @override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    email.getBackground().setColorFilter(getResources().getColor(R.color.black), PorterDuff.Mode.SRC_IN);
    }
    @override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
    @override
    public void afterTextChanged(Editable s) {}
     

    Attached Files:


    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,858
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,858
    11,480
    1,988
    Male
    Software developer
    South West of England
  3. androidworld786

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Apr 13, 2016

    Apr 13, 2016
    2
    0
    5
    Male
     

Share This Page

Loading...