Change bottom navigation selected itemIconTinitcolor - androidx





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















xml file



 <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationDashboardId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:showAsAction="always|withText"
app:itemIconTint="@drawable/bottom_navigation_tab_selector"
app:itemTextColor="@drawable/bottom_navigation_tab_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/menu_bottom_navigation"
app:labelVisibilityMode="labeled"
android:background="#ffffff"
app:elevation="0dp"/>


drawable file:



<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
tools:ignore="MissingDefaultResource">
<item
android:color="@color/colorAccent"
android:state_checked="true"/>
<item android:color="#000000"
android:state_checked="false"/>

</selector>


Gradle dependency



implementation 'androidx.appcompat:appcompat:1.0.0-alpha01'










share|improve this question































    0















    xml file



     <com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottomNavigationDashboardId"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:showAsAction="always|withText"
    app:itemIconTint="@drawable/bottom_navigation_tab_selector"
    app:itemTextColor="@drawable/bottom_navigation_tab_selector"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/menu_bottom_navigation"
    app:labelVisibilityMode="labeled"
    android:background="#ffffff"
    app:elevation="0dp"/>


    drawable file:



    <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
    tools:ignore="MissingDefaultResource">
    <item
    android:color="@color/colorAccent"
    android:state_checked="true"/>
    <item android:color="#000000"
    android:state_checked="false"/>

    </selector>


    Gradle dependency



    implementation 'androidx.appcompat:appcompat:1.0.0-alpha01'










    share|improve this question



























      0












      0








      0








      xml file



       <com.google.android.material.bottomnavigation.BottomNavigationView
      android:id="@+id/bottomNavigationDashboardId"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:showAsAction="always|withText"
      app:itemIconTint="@drawable/bottom_navigation_tab_selector"
      app:itemTextColor="@drawable/bottom_navigation_tab_selector"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:menu="@menu/menu_bottom_navigation"
      app:labelVisibilityMode="labeled"
      android:background="#ffffff"
      app:elevation="0dp"/>


      drawable file:



      <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
      tools:ignore="MissingDefaultResource">
      <item
      android:color="@color/colorAccent"
      android:state_checked="true"/>
      <item android:color="#000000"
      android:state_checked="false"/>

      </selector>


      Gradle dependency



      implementation 'androidx.appcompat:appcompat:1.0.0-alpha01'










      share|improve this question
















      xml file



       <com.google.android.material.bottomnavigation.BottomNavigationView
      android:id="@+id/bottomNavigationDashboardId"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:showAsAction="always|withText"
      app:itemIconTint="@drawable/bottom_navigation_tab_selector"
      app:itemTextColor="@drawable/bottom_navigation_tab_selector"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:menu="@menu/menu_bottom_navigation"
      app:labelVisibilityMode="labeled"
      android:background="#ffffff"
      app:elevation="0dp"/>


      drawable file:



      <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
      tools:ignore="MissingDefaultResource">
      <item
      android:color="@color/colorAccent"
      android:state_checked="true"/>
      <item android:color="#000000"
      android:state_checked="false"/>

      </selector>


      Gradle dependency



      implementation 'androidx.appcompat:appcompat:1.0.0-alpha01'







      android kotlin android-xml material






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 5 at 5:44







      Rambabu Padimi

















      asked Jan 4 at 15:43









      Rambabu PadimiRambabu Padimi

      20916




      20916
























          2 Answers
          2






          active

          oldest

          votes


















          0














          The last item of a selector is usually without any explicit state. And that is because if can be in a lot more states than just checked or unckecked.



          <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
          tools:ignore="MissingDefaultResource">
          <item
          android:color="@color/colorAccent"
          android:state_checked="true"/>
          <item android:color="#000000"/>

          </selector>


          The latest items acts as a default, fallback state.



          This should be black always unless explicitely checked.






          share|improve this answer
























          • It is working for textview and not working for icon

            – Rambabu Padimi
            Jan 5 at 5:45











          • I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

            – shkschneider
            Jan 6 at 14:28



















          0














          Try this, it works for me



          xml--



          <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@color/colorPrimary"
          app:itemIconTint="@drawable/bottom_nav_colors"
          app:itemTextColor="@drawable/bottom_nav_colors"
          app:menu="@menu/bottom_navigation_items"/>


          drawable xml--



          <?xml version="1.0" encoding="utf-8"?>
          <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:state_checked="true"
          android:color="@color/white" />
          <item android:color="@color/black" />
          </selector>





          share|improve this answer
























          • Yes..android support library it is working, but am using new androidx appcompat library

            – Rambabu Padimi
            Jan 9 at 14:19











          • Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

            – Rambabu Padimi
            Jan 9 at 19:22














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54042075%2fchange-bottom-navigation-selected-itemicontinitcolor-androidx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The last item of a selector is usually without any explicit state. And that is because if can be in a lot more states than just checked or unckecked.



          <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
          tools:ignore="MissingDefaultResource">
          <item
          android:color="@color/colorAccent"
          android:state_checked="true"/>
          <item android:color="#000000"/>

          </selector>


          The latest items acts as a default, fallback state.



          This should be black always unless explicitely checked.






          share|improve this answer
























          • It is working for textview and not working for icon

            – Rambabu Padimi
            Jan 5 at 5:45











          • I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

            – shkschneider
            Jan 6 at 14:28
















          0














          The last item of a selector is usually without any explicit state. And that is because if can be in a lot more states than just checked or unckecked.



          <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
          tools:ignore="MissingDefaultResource">
          <item
          android:color="@color/colorAccent"
          android:state_checked="true"/>
          <item android:color="#000000"/>

          </selector>


          The latest items acts as a default, fallback state.



          This should be black always unless explicitely checked.






          share|improve this answer
























          • It is working for textview and not working for icon

            – Rambabu Padimi
            Jan 5 at 5:45











          • I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

            – shkschneider
            Jan 6 at 14:28














          0












          0








          0







          The last item of a selector is usually without any explicit state. And that is because if can be in a lot more states than just checked or unckecked.



          <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
          tools:ignore="MissingDefaultResource">
          <item
          android:color="@color/colorAccent"
          android:state_checked="true"/>
          <item android:color="#000000"/>

          </selector>


          The latest items acts as a default, fallback state.



          This should be black always unless explicitely checked.






          share|improve this answer













          The last item of a selector is usually without any explicit state. And that is because if can be in a lot more states than just checked or unckecked.



          <selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
          tools:ignore="MissingDefaultResource">
          <item
          android:color="@color/colorAccent"
          android:state_checked="true"/>
          <item android:color="#000000"/>

          </selector>


          The latest items acts as a default, fallback state.



          This should be black always unless explicitely checked.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 4 at 16:03









          shkschneidershkschneider

          11.2k114496




          11.2k114496













          • It is working for textview and not working for icon

            – Rambabu Padimi
            Jan 5 at 5:45











          • I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

            – shkschneider
            Jan 6 at 14:28



















          • It is working for textview and not working for icon

            – Rambabu Padimi
            Jan 5 at 5:45











          • I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

            – shkschneider
            Jan 6 at 14:28

















          It is working for textview and not working for icon

          – Rambabu Padimi
          Jan 5 at 5:45





          It is working for textview and not working for icon

          – Rambabu Padimi
          Jan 5 at 5:45













          I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

          – shkschneider
          Jan 6 at 14:28





          I did not know this was about the icon. As for the icon, it needs to be change in code, see stackoverflow.com/q/41826122/603270

          – shkschneider
          Jan 6 at 14:28













          0














          Try this, it works for me



          xml--



          <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@color/colorPrimary"
          app:itemIconTint="@drawable/bottom_nav_colors"
          app:itemTextColor="@drawable/bottom_nav_colors"
          app:menu="@menu/bottom_navigation_items"/>


          drawable xml--



          <?xml version="1.0" encoding="utf-8"?>
          <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:state_checked="true"
          android:color="@color/white" />
          <item android:color="@color/black" />
          </selector>





          share|improve this answer
























          • Yes..android support library it is working, but am using new androidx appcompat library

            – Rambabu Padimi
            Jan 9 at 14:19











          • Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

            – Rambabu Padimi
            Jan 9 at 19:22


















          0














          Try this, it works for me



          xml--



          <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@color/colorPrimary"
          app:itemIconTint="@drawable/bottom_nav_colors"
          app:itemTextColor="@drawable/bottom_nav_colors"
          app:menu="@menu/bottom_navigation_items"/>


          drawable xml--



          <?xml version="1.0" encoding="utf-8"?>
          <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:state_checked="true"
          android:color="@color/white" />
          <item android:color="@color/black" />
          </selector>





          share|improve this answer
























          • Yes..android support library it is working, but am using new androidx appcompat library

            – Rambabu Padimi
            Jan 9 at 14:19











          • Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

            – Rambabu Padimi
            Jan 9 at 19:22
















          0












          0








          0







          Try this, it works for me



          xml--



          <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@color/colorPrimary"
          app:itemIconTint="@drawable/bottom_nav_colors"
          app:itemTextColor="@drawable/bottom_nav_colors"
          app:menu="@menu/bottom_navigation_items"/>


          drawable xml--



          <?xml version="1.0" encoding="utf-8"?>
          <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:state_checked="true"
          android:color="@color/white" />
          <item android:color="@color/black" />
          </selector>





          share|improve this answer













          Try this, it works for me



          xml--



          <android.support.design.widget.BottomNavigationView
          android:id="@+id/navigation"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:background="@color/colorPrimary"
          app:itemIconTint="@drawable/bottom_nav_colors"
          app:itemTextColor="@drawable/bottom_nav_colors"
          app:menu="@menu/bottom_navigation_items"/>


          drawable xml--



          <?xml version="1.0" encoding="utf-8"?>
          <selector xmlns:android="http://schemas.android.com/apk/res/android">
          <item android:state_checked="true"
          android:color="@color/white" />
          <item android:color="@color/black" />
          </selector>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 9 at 5:00









          Android GeekAndroid Geek

          4,95621025




          4,95621025













          • Yes..android support library it is working, but am using new androidx appcompat library

            – Rambabu Padimi
            Jan 9 at 14:19











          • Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

            – Rambabu Padimi
            Jan 9 at 19:22





















          • Yes..android support library it is working, but am using new androidx appcompat library

            – Rambabu Padimi
            Jan 9 at 14:19











          • Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

            – Rambabu Padimi
            Jan 9 at 19:22



















          Yes..android support library it is working, but am using new androidx appcompat library

          – Rambabu Padimi
          Jan 9 at 14:19





          Yes..android support library it is working, but am using new androidx appcompat library

          – Rambabu Padimi
          Jan 9 at 14:19













          Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

          – Rambabu Padimi
          Jan 9 at 19:22







          Mistake from my end, it is working in androidx also. I did mistake in class file bottomNavigationDashboardId.itemIconTintList = null

          – Rambabu Padimi
          Jan 9 at 19:22




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54042075%2fchange-bottom-navigation-selected-itemicontinitcolor-androidx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'