Java 是否可以在android中向首选项活动添加自定义组件?
有没有办法在首选项活动中添加自定义组件以更改设置值?您可以添加任何扩展的自定义组件 或者如果它应该是一个视图-创建一个布局,但是您必须在首选项屏幕的布局中包含一个带有android.R.id.list的ListViewJava 是否可以在android中向首选项活动添加自定义组件?,java,android,sharedpreferences,preferenceactivity,Java,Android,Sharedpreferences,Preferenceactivity,有没有办法在首选项活动中添加自定义组件以更改设置值?您可以添加任何扩展的自定义组件 或者如果它应该是一个视图-创建一个布局,但是您必须在首选项屏幕的布局中包含一个带有android.R.id.list的ListView <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color" >
<YourCustomComponentView
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@+id/view"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
在添加任何首选项之前,只需设置ContentView即可