Note that there are some explanatory texts on larger screens.

plurals
  1. POListView divider not applied when specified in style declaration
    primarykey
    data
    text
    <p>This is more "Why?" than "How?" question, since I know a simple workaround for the problem. But I'd like to know what logic is behind behavior I'm going to describe.</p> <p>I've got a style declaraion and some ListViews. I want to change the way divider looks. I used following declaration:</p> <pre><code>&lt;style name="Theme.MyApp.Dark" parent="@style/Theme.Sherlock"&gt; &lt;item name="android:dividerHeight"&gt;4px&lt;/item&gt; &lt;item name="android:divider"&gt;#123456&lt;/item&gt; &lt;/style&gt; </code></pre> <p>To my amusement, only the height of the divider was applied. I've tried specifying color with alpha value (#12345678) and gradient drawable, nothing works. ListViews are declared like this:</p> <pre><code>&lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; </code></pre> <p>So, as you can see there's nothing that could override style declaration. I can change the divider only when I specify it directly in ListView declaration:</p> <pre><code>&lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list" android:divider="#123456" android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; </code></pre> <p>Using my newly-acquired skill of <a href="https://stackoverflow.com/questions/8630694/">specifying colors depending on theme selected</a>, I can work around this very easily - I will just have to declare <code>android:divider</code> with custom color attribute for every list.</p> <p>But why I can't change <code>android:divider</code> in the style, just like the <code>android:dividerHeight</code>? Is there some reason for that? I couldn't find an explanation, bug report or something similar that would let me understand this behavior.</p> <p>EDIT: The theme is applied globally, in the Manifest file:</p> <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:name="org.my.app" android:theme="@style/Theme.MyApp.Dark"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload