【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트
새로워진 MaterialDesign의 TextField
MaterialDesign
가 새로워졌으며 그 중에서도 TextField
디자인이 업데이트되었습니다.
크게 나누어 2 종류의 디자인으로 변경되었습니다.
Filled text fields 및 Outlined text fields
1은 Filled text fields
2가 Outlined text fields
됩니다.
com.google.android.material 소개
이러한 디자인을 Android에 도입하려면 com.google.android.material
가져오기가 필요합니다.
다음 공식을 참고로 가져옵니다.
Getting started with Material Components for Android
그건 그렇고,이 구성 요소 AndroidX가 필요하지만,
"아직 support lib에서 마이그레이션할 수 없습니다!"라는 사람에게도 com.android.support:design:28.0.0-alpha3
에서 사용할 수 있도록 지원됩니다.
또한 compileSDKVersion
는 P
입니다.
Filled text fields 사용자 정의
우선 이쪽은, Widget.MaterialComponents.TextInputLayout.FilledBox
를 style 지정해 주세요
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 밑줄도 error와 같은 색이 됩니다.
bottomBar
TextInputEditText -> Base.Widget.AppCompat.EditText
colorControlNormal / colorControlNormal
<style name="EditText.Style" parent="Base.Widget.AppCompat.EditText">
<item name="colorControlNormal">#0000FF</item>
<item name="colorControlActivated">#0000FF</item>
</style>
activity_main.xml<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/EditText.Filled">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/EditText.Style"
/>
</com.google.android.material.textfield.TextInputLayout>
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
Outlined text field 사용자 정의
여기 Widget.MaterialComponents.TextInputLayout.OutlinedBox
를 스타일 지정하십시오.
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 아웃라인도 같은 색이 됩니다.
boxStrokeColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> boxStrokeColor
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
요약
MaterialDesign은 처음에는 "사용자가 다양한 플랫폼에서 서비스에 액세스해도 동등한 가치를 얻을 수 있도록"라고 설계되었지만,
점차 우리 개발자를 위해 "더 개발하기 쉽고 서비스의 본질 개발에 집중할 수 있도록"이라는 측면도 강해지고 있으며 단순히 MD를 사용하는 것뿐만 아니라 그 커스터마이징도 쉬워지고 있습니다. 합니다.
그 혜택을 드러내고 더 쉽고 수준 높은 서비스를 만들 수 있도록 우리 엔지니어도 디자인을 알고 싶습니다.
Reference
이 문제에 관하여(【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/CaptainPag/items/5d0b7500e4537b04c4e6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
1은 Filled text fields
2가 Outlined text fields
됩니다.
com.google.android.material 소개
이러한 디자인을 Android에 도입하려면 com.google.android.material
가져오기가 필요합니다.
다음 공식을 참고로 가져옵니다.
Getting started with Material Components for Android
그건 그렇고,이 구성 요소 AndroidX가 필요하지만,
"아직 support lib에서 마이그레이션할 수 없습니다!"라는 사람에게도 com.android.support:design:28.0.0-alpha3
에서 사용할 수 있도록 지원됩니다.
또한 compileSDKVersion
는 P
입니다.
Filled text fields 사용자 정의
우선 이쪽은, Widget.MaterialComponents.TextInputLayout.FilledBox
를 style 지정해 주세요
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 밑줄도 error와 같은 색이 됩니다.
bottomBar
TextInputEditText -> Base.Widget.AppCompat.EditText
colorControlNormal / colorControlNormal
<style name="EditText.Style" parent="Base.Widget.AppCompat.EditText">
<item name="colorControlNormal">#0000FF</item>
<item name="colorControlActivated">#0000FF</item>
</style>
activity_main.xml<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/EditText.Filled">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/EditText.Style"
/>
</com.google.android.material.textfield.TextInputLayout>
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
Outlined text field 사용자 정의
여기 Widget.MaterialComponents.TextInputLayout.OutlinedBox
를 스타일 지정하십시오.
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 아웃라인도 같은 색이 됩니다.
boxStrokeColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> boxStrokeColor
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
요약
MaterialDesign은 처음에는 "사용자가 다양한 플랫폼에서 서비스에 액세스해도 동등한 가치를 얻을 수 있도록"라고 설계되었지만,
점차 우리 개발자를 위해 "더 개발하기 쉽고 서비스의 본질 개발에 집중할 수 있도록"이라는 측면도 강해지고 있으며 단순히 MD를 사용하는 것뿐만 아니라 그 커스터마이징도 쉬워지고 있습니다. 합니다.
그 혜택을 드러내고 더 쉽고 수준 높은 서비스를 만들 수 있도록 우리 엔지니어도 디자인을 알고 싶습니다.
Reference
이 문제에 관하여(【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/CaptainPag/items/5d0b7500e4537b04c4e6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
우선 이쪽은,
Widget.MaterialComponents.TextInputLayout.FilledBox
를 style 지정해 주세요style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.FilledBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 밑줄도 error와 같은 색이 됩니다.
bottomBar
TextInputEditText -> Base.Widget.AppCompat.EditText
colorControlNormal / colorControlNormal
<style name="EditText.Style" parent="Base.Widget.AppCompat.EditText">
<item name="colorControlNormal">#0000FF</item>
<item name="colorControlActivated">#0000FF</item>
</style>
activity_main.xml
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/EditText.Filled">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/EditText.Style"
/>
</com.google.android.material.textfield.TextInputLayout>
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
Outlined text field 사용자 정의
여기 Widget.MaterialComponents.TextInputLayout.OutlinedBox
를 스타일 지정하십시오.
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 아웃라인도 같은 색이 됩니다.
boxStrokeColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> boxStrokeColor
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
요약
MaterialDesign은 처음에는 "사용자가 다양한 플랫폼에서 서비스에 액세스해도 동등한 가치를 얻을 수 있도록"라고 설계되었지만,
점차 우리 개발자를 위해 "더 개발하기 쉽고 서비스의 본질 개발에 집중할 수 있도록"이라는 측면도 강해지고 있으며 단순히 MD를 사용하는 것뿐만 아니라 그 커스터마이징도 쉬워지고 있습니다. 합니다.
그 혜택을 드러내고 더 쉽고 수준 높은 서비스를 만들 수 있도록 우리 엔지니어도 디자인을 알고 싶습니다.
Reference
이 문제에 관하여(【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/CaptainPag/items/5d0b7500e4537b04c4e6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
여기
Widget.MaterialComponents.TextInputLayout.OutlinedBox
를 스타일 지정하십시오.style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
boxBackgroudColor
app:boxBackgroundColor
hintColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> hintTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="hintTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
helperTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> helperTextTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Activate" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Filled" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="helperTextTextAppearance">@style/Sample.InputLayout.Activate</item>
</style>
errorTextColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> errorTextAppearance
TextAppearance.AppCompat.Caption -> android:textColor
<style name="Sample.InputLayout.Error" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">#0000FF</item>
</style>
<style name="EditText.Boxed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="errorTextAppearance">@style/Sample.InputLayout.Error</item>
</style>
※ 아웃라인도 같은 색이 됩니다.
boxStrokeColor
Widget.MaterialComponents.TextInputLayout.OutlinedBox -> boxStrokeColor
cornerRadius
app:boxCornerRadiusTopStart
app:boxCornerRadiusTopEnd
app:boxCornerRadiusBottomStart
app:boxCornerRadiusBottomEnd
요약
MaterialDesign은 처음에는 "사용자가 다양한 플랫폼에서 서비스에 액세스해도 동등한 가치를 얻을 수 있도록"라고 설계되었지만,
점차 우리 개발자를 위해 "더 개발하기 쉽고 서비스의 본질 개발에 집중할 수 있도록"이라는 측면도 강해지고 있으며 단순히 MD를 사용하는 것뿐만 아니라 그 커스터마이징도 쉬워지고 있습니다. 합니다.
그 혜택을 드러내고 더 쉽고 수준 높은 서비스를 만들 수 있도록 우리 엔지니어도 디자인을 알고 싶습니다.
Reference
이 문제에 관하여(【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/CaptainPag/items/5d0b7500e4537b04c4e6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(【TextInputLayout/TextInputEditText】Material.TextField의 커스터마이즈 치트 시트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/CaptainPag/items/5d0b7500e4537b04c4e6텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)