title: Kotlin remove button's background tint
body: <p>I am trying to set a custom background behaviour for my button in Android Studio project, but <code>backgroundTint</code> color keeps interfering with my custom drawable resource.</p>
  <p>When I set <code>backgroundTint</code> to the new color, I still can't get <code>background</code> working correctly. It's just the tint color.</p>
  <p>For some reason, if I don't set my custom <code>backgroundTint</code> color, it just copies <code>colorPrimary</code>.</p>
  <p>I also have <code>android:background=&quot;@drawable/rounded_button_state&quot;</code> in my <code>xml</code> file and I've tried setting the background color programmatically <code>btnSelectFile.setBackgroundResource(R.drawable.rounded_button_state)</code>, although, I'd like to avoid setting it programmatically since I believe it the solution must be much easier.</p>
  <p>My <code>rounded_button_state.xml</code> drawable xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;item android:drawable=&quot;@drawable/background_dark_teal_rounded_corners&quot;
              android:state_pressed=&quot;true&quot; /&gt;
      &lt;item android:drawable=&quot;@drawable/background_bluish_rounded_corners&quot;
              android:state_pressed=&quot;false&quot; /&gt;
  &lt;/selector&gt;
  </code></pre>
  <p>My <code>background_dark_teal_rounded_corners.xml</code> drawable xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
      &lt;item android:alpha=&quot;125&quot;&gt;
          &lt;shape  android:shape=&quot;rectangle&quot;&gt;
              &lt;solid android:color=&quot;@color/dark_teal&quot;/&gt;
              &lt;corners android:radius=&quot;6dp&quot;/&gt;
          &lt;/shape&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  <p>My <code>background_bluish_rounded_corners.xml</code> drawable xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
  &lt;item android:alpha=&quot;125&quot;&gt;
  &lt;shape  android:shape=&quot;rectangle&quot;&gt;
      &lt;solid android:color=&quot;@color/bluish_grey&quot;/&gt;
      &lt;corners android:radius=&quot;6dp&quot;/&gt;
  &lt;/shape&gt;
  &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>
  <p>My main_activity.xml is:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.MainActivity&quot;&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_centerInParent=&quot;true&quot;
          android:layout_centerHorizontal=&quot;true&quot;
          android:orientation=&quot;vertical&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
          app:layout_constraintEnd_toEndOf=&quot;parent&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/tvFileName&quot;
              android:gravity=&quot;center_horizontal&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot; /&gt;
  
          &lt;Button
              android:id=&quot;@+id/btnSelectFile&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:background=&quot;@drawable/rounded_button_state&quot;
              android:text=&quot;@string/tvSelectFile&quot; /&gt;
  
  
      &lt;/LinearLayout&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>In my <code>values/themes.xml</code> I have:</p>
  <pre><code>&lt;item name=&quot;colorPrimary&quot;&gt;@color/purple_500&lt;/item&gt;
  &lt;item name=&quot;colorPrimaryVariant&quot;&gt;@color/purple_700&lt;/item&gt;
  </code></pre>
  <p>My full <code>values/themes.xml</code> file looks like this:</p>
  <pre><code>&lt;resources xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
      &lt;!-- Base application theme. --&gt;
      &lt;style name=&quot;Theme.TestFragmentUpdate&quot; parent=&quot;Theme.MaterialComponents.DayNight.DarkActionBar&quot;&gt;
          &lt;!-- Primary brand color. --&gt;
          &lt;item name=&quot;colorPrimary&quot;&gt;@color/purple_500&lt;/item&gt;
          &lt;item name=&quot;colorPrimaryVariant&quot;&gt;@color/purple_700&lt;/item&gt;
  &lt;!--        &lt;item name=&quot;colorOnPrimary&quot;&gt;@color/white&lt;/item&gt;--&gt;
          &lt;!-- Secondary brand color. --&gt;
  &lt;!--        &lt;item name=&quot;colorSecondary&quot;&gt;@color/teal_200&lt;/item&gt;--&gt;
  &lt;!--        &lt;item name=&quot;colorSecondaryVariant&quot;&gt;@color/teal_700&lt;/item&gt;--&gt;
  &lt;!--        &lt;item name=&quot;colorOnSecondary&quot;&gt;@color/black&lt;/item&gt;--&gt;
          &lt;!-- Status bar color. --&gt;
          &lt;item name=&quot;android:statusBarColor&quot; tools:targetApi=&quot;l&quot;&gt;?attr/colorPrimaryVariant&lt;/item&gt;
          &lt;!-- Customize your theme here. --&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  <p>My second file <code>night/themes.xml</code> in <code>themes</code> folder looks like this:</p>
  <pre><code>&lt;resources xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
      &lt;!-- Base application theme. --&gt;
      &lt;style name=&quot;Theme.TestFragmentUpdate&quot; parent=&quot;Theme.MaterialComponents.DayNight.DarkActionBar&quot;&gt;
          &lt;!-- Primary brand color. --&gt;
          &lt;item name=&quot;colorPrimary&quot;&gt;@color/bluish_grey&lt;/item&gt;
          &lt;item name=&quot;colorPrimaryVariant&quot;&gt;@color/dark_teal&lt;/item&gt;
  &lt;!--        &lt;item name=&quot;colorOnPrimary&quot;&gt;@color/black&lt;/item&gt;--&gt;
          &lt;!-- Secondary brand color. --&gt;
  &lt;!--        &lt;item name=&quot;colorSecondary&quot;&gt;@color/teal_200&lt;/item&gt;--&gt;
  &lt;!--        &lt;item name=&quot;colorSecondaryVariant&quot;&gt;@color/teal_200&lt;/item&gt;--&gt;
  &lt;!--        &lt;item name=&quot;colorOnSecondary&quot;&gt;@color/black&lt;/item&gt;--&gt;
          &lt;!-- Status bar color. --&gt;
          &lt;item name=&quot;android:statusBarColor&quot; tools:targetApi=&quot;l&quot;&gt;?attr/colorPrimaryVariant&lt;/item&gt;
          &lt;!-- Customize your theme here. --&gt;
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  <p>This is when I set a <code>backgroundTint</code> to my own custom color:</p>
  <p><a href="https://i.stack.imgur.com/gkNYI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gkNYI.png" alt="enter image description here" /></a></p>
  <p>And that's when I delete my custom <code>backgroundTint</code> color and the primary one is used:</p>
  <p><a href="https://i.stack.imgur.com/YGHGo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YGHGo.png" alt="enter image description here" /></a></p>