Android dark theme convert my colour from white to black

892 views Asked by At

I want to set Tint to drawable with white colour and I don't what colour to change when I change my application to dark theme so I declare my colour like this.


values/colors.xml
   <color name="white_force">#ffffff</color>

values-night/colors.xml
   <color name="white_force">#ffffff</color>
   

ic_drawable.xml
   <vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="14dp"
    android:height="18dp"
    android:viewportWidth="14"
    android:viewportHeight="18">
        <path
            android:pathData="M12,......,3V15Z"
            android:fillColor="#ffffff" />
    </vector>

layout
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/bookmarkImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:duplicateParentState="true"
        android:padding="@dimen/ds2_space_2dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:src="@drawable/ic_bookmark_white_14" />

</androidx.constraintlayout.widget.ConstraintLayout>

but when I set Tint to my drawable when I change my app to dark mode it set colour t0 black instead of white.

0

There are 0 answers