应该不会有这个困难,但它是:
<com.yourpackage.CustomPreference
android:dialogMessage="@string/summary"
android:summary="@string/summary"
android:title="@string/title"
android:key="preference"
android:layout="@layout/custom_preference_title"
/>
布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="?android:attr/listPreferredItemHeight">
<TextView
android:id="@+android:id/title"
style="@android:style/TextAppearance.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft"
android:text="test" />
</RelativeLayout>
好吧,我会试试这个..谢谢! – andineupert
我不得不使用在xml中定义的自定义布局,如下所示:[link](http://stackoverflow.com/questions/6194116/creating-a-custom-layout-for-preferences),然后设置标题Textview到TextAppearance.Medium就像你说的那样调整左边距。现在看起来不错。谢谢! – andineupert