I have to show max 3.5 lines in my EditText if lines are more then 3. I tried lots of property but still not able to implement that.
If a set android:layout_height="wrap_content" it will show N number of lines.
Do we have any property combination or I'll have to do it manually.
Say I fixed some height to android:layout_height="36dp" and if line count is >= 4 again I have to set android:layout_height="48dp" in this way i'll achieve what I am looking for.
EDIT
public void onTextChanged(CharSequence s, int start, int before, int count){
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) txtMessage.getLayoutParams();
if(txtMessage.getLineCount() > 3){
if(lp.height != 0) {
txtMessage.getLayoutParams().height = 0;
}
}else if(lp.height != ViewGroup.LayoutParams.WRAP_CONTENT){
txtMessage.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
}
}
show at least 3 lines for me :)
You can use android:maxLines="3"
to force the EditText
to show no more than 3 lines.
But for 3.5, you can only do this by manually setting EditText
height.