EditText
내부를 사용하고 TextInputLayout
있지만 지원 라이브러리를 23.2.0으로 업그레이드 한 후 logcat에 다음 경고가 표시됩니다. 일반 EditText
및 a 의 차이점은 무엇입니까 TextInputEditText
? 이에 대한 문서를 찾을 수없는 것 같습니다.
답변
이것도 궁금해서 다니엘 윌슨 이 문서를 모았지만 훈련받지 않은 눈에는 그다지 의미가 없습니다. 여기에 대한 내용이 있습니다. “추출 모드” 는 공간이 너무 작을 때 표시되는보기 유형 (예 : 휴대 전화의 가로 모드)을 나타냅니다. Google 키보드와 함께 Galaxy S4를 IME (입력기)로 사용하고 있습니다.
IME가 표시되지 않는 가로 UI
포커스 (Description)에 TextInputLayout
따라 에디터 외부에서 힌트를 밀어내는 동작을 볼 수 있습니다 . 여기에 특별한 것은 없습니다. 이것이 TextInputLayout
해야 할 일입니다.
풍경 UI 편집 빈 이름 필드
이름을 편집하면 IME가 편집중인 내용에 대한 힌트를 제공하지 않음을 알 수 있습니다.
풍경 UI 편집 빈 설명 필드
설명을 편집하면 IME가 편집중인 내용에 대한 힌트를 제공함을 알 수 있습니다.
레이아웃 XML
두 필드의 차이점은 유형 EditText
VS TextInputEditText
입니다. 중요한 것은 여기 즉 TextInputLayout
이 android:hint
경우이 경우, 그리고 랩 글고 치기를 TextInputEditText
자바 코드의 몇 줄은 큰 차이가 있습니다.
이름 필드
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Item Name"
>
<EditText
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.TextInputLayout>
설명 필드
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Item Description"
>
<android.support.design.widget.TextInputEditText
android:id="@+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:minLines="4"
android:scrollbars="vertical"
/>
</android.support.design.widget.TextInputLayout>
답변
그것에 대한 문서는 없지만 클래스는 EditText
단일 추가 기능 이있는 일반 클래스입니다 .
이 클래스를 사용하면 ‘추출’모드에서 IME에 힌트를 표시 할 수 있습니다.
구체적으로 EditorInfo.hintText
. 당신은에 알 수 있습니다 TextInputLayout
당신이 힌트를 지정할 수 있습니다 클래스와는 외관보다는 자식의 한 부분으로의 EditText
위젯.
그렇게해야하는 경우를 사용해야 TextInputEditText
하므로에서 지정한 힌트 정보에주의를 기울여야합니다 TextInputLayout
.
답변
그것들은 본질적으로 똑같지 만, TextInputEditText
더 많은 기능과 속성이 있다고 생각 합니다. 나는로 변경 TextInputEditText
했고 모든 것이 작동했고 이전에 표준에서했던 것처럼 보였다 EditText
.
답변
유일한 차이점은 장치가 가로 모드에 TextInputEditText
있을 때 힌트를 표시하지만 표시 EditText
하지 않는다는 것입니다.
답변
이 문제가 발생하여 xml 파일에서 다음 줄을 삭제했습니다.
android: fitsSystemWindows = "true"
오류가 사라졌습니다.
답변
