带有 TextItems 的 PreferenceActivity

发布于 2024-12-06 05:50:38 字数 240 浏览 7 评论 0原文

我想使用 PreferenceActivity 进行游戏设置。但我想添加到该列表中,以便在列表中的设置项之后,只有诸如“MyGame,版本 0.1”之类的文本项或可单击的文本项“评价我的应用程序”等。

什么是“正确”或者最直接的方法?我知道我可以指定一个包含 ListView 的自定义布局 xml,并使用首选项填充它,但我也希望在该 ListView 中包含我的自定义(可单击)文本项,或者至少看起来像它们在该列表中一样。

I'd like to use PreferenceActivity for my games settings. But I'd like to add to that list, so that after the settings items in the list, there would be just text items like "MyGame, version 0.1" or clickable text item "Rate my app" etc.

What's the "correct" or most straighforward way of doing this? I know I can specify a custom layout xml with ListView in it and populate that with the preferences but I'd like to have my custom (clickable) text items in that ListView too, or atleast appear like they were in that list.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小梨窩很甜 2024-12-13 05:50:38

我试图告诉的是,我需要这张图片中显示的“服装偏好”[原文如此]:

自定义首选项
(来源:kaloer.com

您可以使用

<Preference
    android:title="Custom Preference"
    android:summary="This works almost like a button"
    android:key="customPref" />

我从以下位置找到的示例来创建它: http://www.kaloer.com/android-preferences

What I tried to tell was that I needed what is shown as "Costum Preference" [sic] in this picture:

custom preference
(source: kaloer.com)

You can create it just by using

<Preference
    android:title="Custom Preference"
    android:summary="This works almost like a button"
    android:key="customPref" />

This example I found from: http://www.kaloer.com/android-preferences

温折酒 2024-12-13 05:50:38

在活动中使用该文件后,要将所有设置放入下面的 XML 文件中,所有设置都会显示在列表中。

<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:example="http://schemas.android.com/apk/res/com.uks.android.frsad.common">

<EditTextPreference android:title="Server URL"
        android:dialogTitle="Server URL Path" android:dialogMessage="Path of Web Server"
        android:key="server_url_path" android:summary="Sets the Server URL Path for WebService." />
</PreferenceScreen>

To put all setting to below XML file after that file use in the activity all setting are display in list.

<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:example="http://schemas.android.com/apk/res/com.uks.android.frsad.common">

<EditTextPreference android:title="Server URL"
        android:dialogTitle="Server URL Path" android:dialogMessage="Path of Web Server"
        android:key="server_url_path" android:summary="Sets the Server URL Path for WebService." />
</PreferenceScreen>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文