Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid set divider padding for preference screen
    text
    copied!<p>I have PreferenceScreen contain many CheckBox , i customize it by refer it to custom layout as bellow :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;CheckBoxPreference android:summary="checkbox one" android:key="key_one" android:layout="@layout/mylayout" /&gt; &lt;CheckBoxPreference android:summary="checkbox two" android:key="key_two" android:layout="@layout/mylayout" /&gt; &lt;/PreferenceScreen&gt; </code></pre> <p><strong>mylayout.xml:</strong></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical" android:paddingRight="?android:attr/scrollbarSize"&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center" android:minWidth="@dimen/preference_icon_minWidth" android:orientation="horizontal"&gt; &lt;ImageView android:id="@+android:id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /&gt; &lt;/LinearLayout&gt; &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="16dip" android:layout_marginRight="8dip" android:layout_marginTop="6dip" android:layout_marginBottom="6dip" android:layout_weight="1"&gt; &lt;TextView android:id="@+android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:fadingEdge="horizontal" /&gt; &lt;TextView android:id="@+android:id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@android:id/title" android:layout_alignLeft="@android:id/title" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorSecondary" android:maxLines="4" /&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:id="@+android:id/widget_frame" android:layout_width="wrap_content" android:layout_height="match_parent" android:minWidth="@dimen/preference_widget_width" android:gravity="center" android:orientation="vertical" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Every thing run fine also i customize divider between checkbox in prefs activity as :</p> <pre><code> ListView list = (ListView) findViewById(android.R.id.list); list.setDivider(new ColorDrawable(Color.RED)); // or some other color int list.setDividerHeight((5)); list.setVerticalScrollBarEnabled(false); </code></pre> <p>when i want to set padding to divider only as :</p> <pre><code> list.setPadding(0, 0, 0, 0); </code></pre> <p>it set padding to all view ,</p> <p>HOW can i set padding to divider only without affect padding of all view .</p> <p>any help will be appreciated, thanks</p>
 

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