Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to keep the dividers around a non selectable preference?

If you set the selectability of a preference item to false, you will notice that the dividers around that item will disappear.

Do you know if there is a way to keep those dividers?

I have looked at the ListView API and could not find a solution that could be applied here, since there is no selectable attribute for ListView items (except for the headers and footers).

Thanks!

like image 273
Amokrane Chentir Avatar asked Aug 26 '13 13:08

Amokrane Chentir


1 Answers

I did it with a hack.

<Preference android:layout="@layout/preference_divider" />
<Preference android:title="@string/whatever" android:selectable="false" />

res/layout/preference_divider.xml

<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#cccccc"
    android:layout_width="fill_parent"
    android:layout_height="1px" />
like image 188
Dave Aaron Smith Avatar answered Nov 17 '22 05:11

Dave Aaron Smith