Contact (contacts) to learn how to change the phone number font in contacts:
The effect is as follows:
The changes are as follows:
Implementation Method:
1. The activity implements the textwatcher interface.
2. Rewrite the following three methods:
Private edittext mdigits;
Public void beforetextchanged (charsequence S, int start, int count, int after ){
}
Public void ontextchanged (charsequence input, int start, int before, int changecount ){
}
Public void aftertextchanged (editable input ){
If (mdialpad! = NULL ){
If (input. tostring (). Length () <= 14 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 60f );
} Else if (input. tostring (). Length () <= 17 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 50f );
} Else if (input. tostring (). Length () <= 21 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 40f );
} Else {
Mdigits. settextsize (typedvalue. complex_unit_px, 30f );
}
} Else {
If (input. tostring (). Length () <= 20 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 60f );
} Else if (input. tostring (). Length () <= 24 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 50f );
} Else if (input. tostring (). Length () <= 31 ){
Mdigits. settextsize (typedvalue. complex_unit_px, 40f );
} Else {
Mdigits. settextsize (typedvalue. complex_unit_px, 30f );
}
}
If (specialcharsequencemgr. handlechars (this, input. tostring (), mdigits )){
Mdigits. gettext (). Clear ();
}
}