[英]Using Image in Android studio "startIconDrawable" is showing grey
I am setting a an icon in material TextInputLayout but the icon is showing as grey not its original color(Shown in the image below).我在材质 TextInputLayout 中设置了一个图标,但该图标显示为灰色而不是其原始颜色(如下图所示)。 Using the same icon image in a Image View is showing colors.
在图像视图中使用相同的图标图像显示 colors。 I have searched a lot and haven't found any solutions.
我进行了很多搜索,但没有找到任何解决方案。
Any help will be great.任何帮助都会很棒。 Thanks in advance.
提前致谢。
XML for the 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>
Simply add this line to your xml TextinputLayout Xml file只需将此行添加到您的 xml TextinputLayout Xml 文件
app:startIconTint="@null"
<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:layout_margin="10dp"
android:hint="کشور"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:startIconDrawable="@drawable/blue_cheese"
app:startIconTint="@null">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="+91" />
</com.google.android.material.textfield.TextInputLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.