Gau*_*rav 1 android android-layout
我在材质 TextInputLayout 中设置一个图标,但该图标显示为灰色,而不是其原始颜色(如下图所示)。在图像视图中使用相同的图标图像会显示颜色。我进行了很多搜索,但没有找到任何解决方案。
任何帮助都会很棒。提前致谢。
TextInputLayout 的 XML :-
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/country"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/country"
app:layout_constraintBottom_toBottomOf="parent"
app:startIconDrawable="@drawable/flag"
app:layout_constraintStart_toStartOf="parent"
android:layout_margin="10dp">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="+91"
android:enabled="false"/>
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
只需将此行添加到您的 xml TextinputLayout Xml 文件中
\napp:startIconTint="@null"\n\n\n <com.google.android.material.textfield.TextInputLayout\n android:id="@+id/country"\n style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:layout_margin="10dp"\n android:hint="\xda\xa9\xd8\xb4\xd9\x88\xd8\xb1"\n app:layout_constraintBottom_toBottomOf="parent"\n app:layout_constraintEnd_toEndOf="parent"\n app:layout_constraintStart_toStartOf="parent"\n app:layout_constraintTop_toTopOf="parent"\n app:startIconDrawable="@drawable/blue_cheese"\n app:startIconTint="@null">\n\n <com.google.android.material.textfield.TextInputEditText\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:enabled="false"\n android:text="+91" />\n\n</com.google.android.material.textfield.TextInputLayout>\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
904 次 |
| 最近记录: |