首选项 Activity 中的 ListItem/TextView
我正在将偏好活动用于项目中的设置功能。一切都很完美。我刚刚遇到一个问题,我不知道如何解决。我想要一个可点击的 ListItem,基本上是我们在列表视图中看到的文本视图。我想要在首选项活动中有一个可点击的项目,例如启动另一个活动的文本视图。但我找不到如何添加。有复选框首选项/列表首选项等。我一直将其用于我的首选项设置目的。我的首选项 xml 如下所示:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:threefiftyprefs="http://schemas.android.com/apk/res/com.farter.accelero" >
<PreferenceCategory
android:title="Application">
<ListPreference
android:summary="@string/pref_summary_orientation_flag"
android:title="@string/pref_title_orientation_flag"
android:key="@string/pref_key_flag_orientation"
android:entries="@array/orientation_label"
android:defaultValue="1"
android:entryValues="@array/orientation_values"
android:persistent="true"
/>
<ListPreference
android:summary="@string/pref_summary_axis_flag"
android:title="@string/pref_title_axis_flag"
android:key="@string/pref_key_flag_axis"
android:entries="@array/axis_label"
android:defaultValue="1"
android:entryValues="@array/axis_values"
android:persistent="true"
/>
</PreferenceCategory>
<PreferenceCategory android:title="Phrase">
<CheckBoxPreference
android:key="phras1"
android:title="a"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra2"
android:title="b"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra3"
android:title="c"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra4"
android:title="d"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra5"
android:title="e"
android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen>
Where to add an clickable view item and how to get that view to add click Listener for Start new Activity。只需要想法或片段。
谢谢。
I am using preferenceactivity for my settings feature in project. Everything is perfect. I just ran into one problem that i don't know how to pass. I want a ListItem which is clickable, basically a textview that we see in listview. I want a clickable item in preference activity like textview that starts another activity. But i couldn't find how to add. There are checkboxpreference/listpreference etc. I have been using that for my presference setting purpose. Here is my preference xml looks like:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:threefiftyprefs="http://schemas.android.com/apk/res/com.farter.accelero" >
<PreferenceCategory
android:title="Application">
<ListPreference
android:summary="@string/pref_summary_orientation_flag"
android:title="@string/pref_title_orientation_flag"
android:key="@string/pref_key_flag_orientation"
android:entries="@array/orientation_label"
android:defaultValue="1"
android:entryValues="@array/orientation_values"
android:persistent="true"
/>
<ListPreference
android:summary="@string/pref_summary_axis_flag"
android:title="@string/pref_title_axis_flag"
android:key="@string/pref_key_flag_axis"
android:entries="@array/axis_label"
android:defaultValue="1"
android:entryValues="@array/axis_values"
android:persistent="true"
/>
</PreferenceCategory>
<PreferenceCategory android:title="Phrase">
<CheckBoxPreference
android:key="phras1"
android:title="a"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra2"
android:title="b"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra3"
android:title="c"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra4"
android:title="d"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="phra5"
android:title="e"
android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen>
Where to add an clickable view item and how to get that view to add click listener for starting new activity. Just need idea or snippet.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: