0

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.

enter image description here

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>
Nima Khalili
  • 360
  • 4
  • 20
  • 1
    If that's the default hamburger-arrow icon, I think you should still be able to style it like this: https://stackoverflow.com/a/47131306. The default `drawableSize` is `24dp`, IIRC. That goes in your app theme, though, not the `NavigationView`'s style. That icon is not a property of `NavigationView`. – Mike M. Dec 06 '21 at 08:36

2 Answers2

0

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);
            }
        });
Sadegh J
  • 1,603
  • 2
  • 9
  • 22
0

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>
Nima Khalili
  • 360
  • 4
  • 20