By using
<item
android:id="@+id/nav_ad"
android:title="@null"
app:actionLayout="@layout/sidebar_ad" />
I can use my custom layout and create a native ad inside the NavigationView. However, the list item's height seems to be fixed at the same value, which means it's impossible to change a specific item's height individually.
View view = mNavView.getMenu().findItem(R.id.nav_ad).getActionView()
does return the custom view I created, however view.getParent()
returns null, which means there is no way to get the container's reference to setMinimumHeight()
on it.
I have even thought of using reflection to hack NavigationMenuAdapter
, but since it's a private inner class, I even don't know where to start.
Is using another drawer library / write my own drawer view the only way to go?
app:showAsAction="always"
– Insistencylayout/sidebar_ad
– Insistency