2016-07-26 66 views

回答

2

退房:

Courtesy: Google Material: Color Schemes

+0

不錯的答案+1,完全相同:) –

+0

@falcon如果有助於將此標記爲答案,以便對其他人也有幫助。 –

+0

@ShrenikShah謝謝!正是我在找什麼。 –

0

經過下面的代碼,添加TextWatcher和你的邏輯:

phoneNumber = (EditText) findViewById(R.id.phone); 
tag = (TextView) findViewById(R.id.tag); 

phoneNumber.addTextChangedListener(new TextWatcher() { 

    @Override 
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { 

    } 

    @Override 
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { 

    } 

    @Override 
    public void afterTextChanged(Editable editable) { 

     String mobNo = editable.toString(); 

     if (mobNo != null && mobNo.length() >= 1) { 

      if (mobNo.contains(",")) { 
       mob = new SpannableString(mobNo.replace(",", "")); 
       tag.setText(mob); 
       phoneNumber.setText(""); 
      } 
     } 
    } 
}); 

添加您的邏輯,多個數據持久性。