In EditText,
When text can not be displayed completely and you lose focus,
Are there any tags that can be set so that it displays the text with ellipses?
In EditText,
When text can not be displayed completely and you lose focus,
Are there any tags that can be set so that it displays the text with ellipses?
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
if(view.hasFocus()){
// se tá com foco, então pôe os "..." no texto
} else {
// se tá sem foco, então mostra o texto inteiro
}
}
});
You need to do this in XML
<EditText
...
android:maxLines="1" />
And then you need to put it in Java
String text = edit_text.getText().toString();
if(text.length() > 8){
edit_text.setText(text.substring(0, 8) + "...");
}
So if it gets bigger than 8 characters it will put the ... in the end