728x90
사용자에게 텍스트 입력 줄을 제한하기 위해 maxLines을 사용한다면 inputType도 같이 사용해야 한다.
1. maxLines="1" 만 사용한 경우
1줄을 다 적어도 그 다음 줄로 개행되어 여전히 텍스트가 적힌다.
2. maxLines="1" 과 inputType 을 같이 사용한 경우
1줄로만 이어 적히는 것을 확인할 수 있다.
이 때는 maxLines에 1이상의 숫자를 설정해 놓아도 1줄로만 입력된다.
> 예제 코드
더보기
<EditText
android:id="@+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:padding="15dp"
android:maxLines="1"
android:hint="email"
android:inputType="textEmailAddress" />
(참고)
https://stack07142.tistory.com/112
Android - EditText maxLines 적용이 안되는 현상
Android - EditText maxLines 적용이 안되는 현상 EditText 생성 후 EditText를 1줄로만 사용하기 위해서는 다음과 같은 속성을 주시면 됩니다. android:maxLines="1" 그러나 텍스트 입력 후 엔터 버튼을 누르면 여
stack07142.tistory.com
728x90
'Android Studio' 카테고리의 다른 글
[Android][Kotlin]MVVM,Hilt,Retrofit2,RecyclerView 활용 예시 (0) | 2024.01.19 |
---|---|
[Android][Firebase][해결]Missing or insufficient permissions. (0) | 2022.11.07 |
[Android][Firebase][해결]StorageException (0) | 2022.09.20 |
[Android][Firebase][Kotlin]데이터 읽기 관련 메소드 (0) | 2022.09.09 |
[Android][Firebase][Kotlin]데이터 쓰기(저장) 관련 메소드 (0) | 2022.08.27 |