Change fill color on vector asset in Android Studio

后端 未结 12 1971
盖世英雄少女心
盖世英雄少女心 2020-12-02 04:09

Android Studio now supports vector assets on 21+ and will generate pngs for lower versions at compile time. I have a vector asset (from the Material Icons) that I want to c

12条回答
  •  忘掉有多难
    2020-12-02 04:54

    Go to you MainActivity.java and below this code
    -> NavigationView navigationView = findViewById(R.id.nav_view);
    Add single line of code -> navigationView.setItemIconTintList(null);
    i.e. the last line of my code

    I hope this might solve your problem.

    public class MainActivity extends AppCompatActivity {
    
        private AppBarConfiguration mAppBarConfiguration;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            Toolbar toolbar = findViewById(R.id.toolbar);
            setSupportActionBar(toolbar);
    
            DrawerLayout drawer = findViewById(R.id.drawer_layout);
            NavigationView navigationView = findViewById(R.id.nav_view);
            navigationView.setItemIconTintList(null);
    

提交回复
热议问题