请帮助解决这个问题。 我使用Victor库,当我想使用菜单项
时我有问题使用这个库我接下来 - “使用这个插件,你可以为SVG定义源文件夹,它们将自动被栅格化/包含在你的构建中,而不会弄乱你的源代码。”
`<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/catalog"
android:icon="@drawable/catalog_not_selected"
android:title="Catalog" />
<item
android:id="@+id/favorites"
android:icon="@favorites_not_selected"
android:title="Favorites" />
</menu>`
部分使用我的gradle文件:
apply plugin: 'com.trello.victor'
android {
vectorDrawables.useSupportLibrary = true
}
sourceSets {
main {
svg.srcDir 'src/main/svg'
}
}
victor {
svgDpi = 32
excludeDensities = [ 'mdpi', 'xxxhdpi' ]
generateVectorDrawables = false
}
dataBinding {
enabled = true
}
我想要的代码使用它:
mBottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
if (tabId == R.id.catalog) {
mBottomBar.setItems(R.menu.bottombar_tabs_catalog);
//mBottomBar.setItems(sResource[0][1]);
}
if (tabId == R.id.favorites) {
mBottomBar.setItems(R.menu.bottombar_tabs_favorites);
}
}
});