Inserting an Admob MEDIUM_RECT into Android design library's NavigationView's menu
Asked Answered
A

0

7

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?

Antidepressant answered 13/10, 2017 at 9:59 Comment(3)
did you try app:showAsAction="always"Insistency
I just tried, it does no effect at NavigationView's menu.Antidepressant
can you share you layout/sidebar_adInsistency

© 2022 - 2024 — McMap. All rights reserved.