Navigation Drawer Android API specific Layout Attribute

后端 未结 2 1565
甜味超标
甜味超标 2020-12-29 12:54

Hello I have created a navigation drawer with ListView navigation using ActionBar Sherlock and android support Library v4 for old version compatbil

相关标签:
2条回答
  • 2020-12-29 13:14

    I am not sure if you really need to use android dimensions (like listPreferredItemHeightSmall etc.) In some android version can that dimension be 12 and in other 14. I suggest you to create your own dimension, which will be used in your whole app, and you can easily edit them when change is needed.

    0 讨论(0)
  • 2020-12-29 13:19

    To support lower versions, instead of removing the following three parameters,

      android:textAppearance="?android:attr/textAppearanceListItemSmall" 
      android:background="?android:attr/activatedBackgroundIndicator"
      android:minHeight="?android:attr/listPreferredItemHeightSmall"
    

    You can actually replace them with equivalent values/resources.

    The equivalent values can be obtained from https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml

    Now,

    • a) android:textAppearance="@android:style/TextAppearance.Medium"

    • b)

      1. Download a selector from https://github.com/habzy/Test0011_DialerPad/blob/master/res/drawable/list_item_activated_background.xml

      2. In the above project browse the resources in hdpi,mdpi etc and get files named list_activated_holo.9.png

      3. Finally

      android:background="@drawable/list_item_activated_background"

    • c) From the equivalent values obtained , we know that listPreferredItemHeightSmall is 48dip

      android:minHeight="48dip"

    0 讨论(0)
提交回复
热议问题