listPreferredItemHeightSmall is not working on api

2019-05-26 21:49发布

问题:

I am using the code below and it's working fine on api 23 but not on another device on api 16(Jelly Bean) .

Style:

<style name="NavigationViewStyle">
     <item name="android:textSize">20sp</item> <!-- menu item text size-->
     <item name="android:listPreferredItemHeightSmall">40dp</item><!-- menu item height-->
</style>

And then, apply this style to NavigationView using app:theme

<android.support.design.widget.NavigationView
       ...
       ...    
        app:theme="@style/NavigationViewStyle"
       ...
       ...


</android.support.design.widget.NavigationView>

回答1:

You should use "android:listPreferredItemHeightSmall" without "android" nameSpace for older versions.