@Swayam you are right, But this solution has improved :
1- better performance
2- in your solution if you entered 7 lines (your max input lines) then pressed enter in Top lines the last line will be delete, But in this solution "enter" key has ignored.
mEditText.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
if ( ((EditText)v).getLineCount() >= 7 )
return true;
}
return false;
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…