1

对于我的偏好屏幕 xml,我想增加一个自定义布局。这是我的偏好屏幕xml:

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"

-----
-----

<Preference
        android:key="preview"
        android:layout="@layout/redesign_preview_pref_layout"
        android:persistent="false"
        android:title="@string/setting_preview" />

除“预览”首选项外,此屏幕的一切都正常。它不会夸大“redesign_preview_pref_layout”布局。

这是“redesign_preview_pref_layout”布局代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="15dp" >

    <TextView
        android:id="@+id/previewScreen"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:background="@color/half_transpernt_button_color"
        android:gravity="center"
        android:text="@string/pref_preview_button"
        android:textColor="@android:color/white"
        android:textSize="16sp" />

</LinearLayout>

有人可以告诉我我做错了什么来帮助我吗?谢谢你的帮助

4

0 回答 0