I want to design an activity with different sizes but my problem is i cant change the size of the navigationView
icon in the action bar
.
NavigationView :
<com.google.android.material.navigation.NavigationView
android:id="@ id/navigationView_main"
style="@style/NavigationView.all"
/>
Style :
<style name="NavigationView.all" >
<item name="android:layout_width">@dimen/widthNavigationView_all</item>
<item name="android:layout_height">match_parent</item>
<item name="headerLayout">@layout/navigation_all_header</item>
<item name="android:layout_gravity">start</item>
<item name="itemIconTint">@color/itemIconTint_navigationView</item>
<item name="itemTextColor">@color/itemTextColor_navigationView</item>
</style>
CodePudding user response:
You can use toolbar instead of action bar and simply use your custom icon:
toolbar.post(new Runnable() {
@Override
public void run() {
Drawable d = ResourcesCompat.getDrawable(getResources(), R.mipmap.ic_launcher, null);
toolbar.setNavigationIcon(d);
}
});
CodePudding user response:
I found solution. We need to access DrawerArrowToggle style attributes.
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar.Bridge">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="drawerArrowStyle">@style/DrawerArrowToggle</item>
</style>
//Style required
<style name="DrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="barLength">28dp</item>
<item name="gapBetweenBars">5dp</item>
<item name="drawableSize">24dp</item>
</style>