개발 (develop)

[Android] EditText maxLines 적용이 안되는 현상​

삽질그만 2022. 8. 5. 11:04

Android - EditText maxLines 적용이 안되는 현상

EditText 생성 후 EditText를 1줄로만 사용하기 위해서는 다음과 같은 속성을 주시면 됩니다.

android:maxLines="1"​

그러나 텍스트 입력 후 엔터 버튼을 누르면 여전히 개행이 되는데요,

maxLines 설명을 보시면 EditText에서는 반드시 inputType이 같이 설정되어야 함을 알 수 있습니다.

Makes the TextView be at most this many lines tall. When used on an editable text, the inputType attribute's value must be combined with the textMultiLine flag for the maxLines attribute to apply.