mam PreferenceScreen zawierają wiele opcji, to i dostosować ją skierować ją do niestandardowy układ jak poniżej:android zestaw dzielnik wyściółka na ekranie preferencji
<?xml version="1.0" encoding="utf-8" ?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:summary="checkbox one"
android:key="key_one"
android:layout="@layout/mylayout"
/>
<CheckBoxPreference
android:summary="checkbox two"
android:key="key_two"
android:layout="@layout/mylayout"
/>
</PreferenceScreen>
mylayout.xml:
<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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:minWidth="@dimen/preference_icon_minWidth"
android:orientation="horizontal">
<ImageView
android:id="@+android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
<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">
<TextView
android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:fadingEdge="horizontal" />
<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" />
</RelativeLayout>
<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" />
</LinearLayout>
Każdego wszystko działa dobrze, a także dostosowuję dzielnik między polami wyboru w aktywności prefs jako:
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);
gdy chcę ustawić dopełnienie do dzielnika jedynie jako:
list.setPadding(0, 0, 0, 0);
to ustawić dopełnienie wszystkich widzenia
Jak mogę ustawić dopełnienie do dzielnika tylko bez wpłynąć na dopełnienie wszystkich widzenia.
Każda pomoc będzie mile widziany, dzięki
Witam, staram się usunąć linii podziału w moim preferencji fragmentu. Ale nie dostaję jak zadzwonić 'ListView list = (ListView) findViewById (android.R.id.list);' Nie mam obiektu widoku w części – Naruto