Search code examples
javaandroidandroid-layoutandroid-listviewdivider

Android: What's the default value of android:dividerHeight for a listview


Simple question: What is the default value of android:dividerHeight for a normal listview? I bet you can probably look it up somewhere, but I wouldn't know where.

Thanks in advance!


Solution

  • Both of the other answers are just partly right. The ListView_dividerHeight is stylable but Android itself doesn't set a default value (at least not the stock Android). If the app itself doesn't set the value like this e.g.:

    <item name="android:dividerHeight">5dp</item>
    

    then @android:drawable/divider_horizontal_dark_opaque will be used which exists in four different "flavors" (ldpi, mdpi, hdpi and xhdpi).

    So the "real" answer is: there's no way to tell. It depends on:

    • Screen density
    • Android version
    • Customization by the manufacturer
    • App theming
    • possibly other factors

    To find these answers yourself check out your Android SDK folder: platforms\android-17\data\res\values\attrs.xml / styles.xml / themes.xml (android-17 might be different for your installation) and read the documentation about themes & styles: http://developer.android.com/guide/topics/ui/themes.html