在 TextInputLayout 中使用 app:helperTextColor
Ussing app:helperTextColor in TextInputLayout
我正在尝试更改 TextInputLayout
的帮助文本的颜色,但没有成功。
设置 app:helperTextColor
属性给我以下错误:
AAPT: error: attribute helperTextColor (aka com.mypackage:helperTextColor) not found.
link 到 material 网站:link
这就是我想要改变的:
代码如下:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/webSiteInput"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_24"
android:layout_marginStart="@dimen/standard_32"
android:layout_marginEnd="@dimen/standard_32"
app:errorEnabled="true"
app:error="@{viewModel.errorMessage}"
app:errorTextColor="@color/color130"
app:errorIconDrawable="@null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarAddSite"
android:textColorHint="@color/color100"
app:hintTextColor="@color/color100"
android:hint="@{viewModel.hintText}"
app:helperTextColor="@color/red"
app:helperText="Test the color of the helper text"
app:endIconMode="none"
app:boxStrokeColor="@color/color94"
app:boxStrokeErrorColor="@color/color130"
tools:hint="Test the hint">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:lines="1"
android:textColor="@color/color95"
android:text="@={viewModel.url}" />
</com.google.android.material.textfield.TextInputLayout>
您必须使用 helperTextTextColor
属性:
<com.google.android.material.textfield.TextInputLayout
app:helperTextTextColor="@color/...."
../>
我正在尝试更改 TextInputLayout
的帮助文本的颜色,但没有成功。
设置 app:helperTextColor
属性给我以下错误:
AAPT: error: attribute helperTextColor (aka com.mypackage:helperTextColor) not found.
link 到 material 网站:link
这就是我想要改变的:
代码如下:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/webSiteInput"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/standard_24"
android:layout_marginStart="@dimen/standard_32"
android:layout_marginEnd="@dimen/standard_32"
app:errorEnabled="true"
app:error="@{viewModel.errorMessage}"
app:errorTextColor="@color/color130"
app:errorIconDrawable="@null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbarAddSite"
android:textColorHint="@color/color100"
app:hintTextColor="@color/color100"
android:hint="@{viewModel.hintText}"
app:helperTextColor="@color/red"
app:helperText="Test the color of the helper text"
app:endIconMode="none"
app:boxStrokeColor="@color/color94"
app:boxStrokeErrorColor="@color/color130"
tools:hint="Test the hint">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:lines="1"
android:textColor="@color/color95"
android:text="@={viewModel.url}" />
</com.google.android.material.textfield.TextInputLayout>
您必须使用 helperTextTextColor
属性:
<com.google.android.material.textfield.TextInputLayout
app:helperTextTextColor="@color/...."
../>