【问题标题】:Cofused with the key of preference screen element与偏好屏幕元素的键混淆
【发布时间】:2011-11-02 09:32:04
【问题描述】:

在 checkBoxPreference 中有一个键 (android:key="show_airline_column_pref"),我知道当我想为复选框存储值时使用此键(如果它设置或未设置)。但我的困惑来自 prefScreen 键 (android:key="flight_columns_pref") ,为什么这个键存在?我应该在 prefScreen 的键中存储什么值?

有人能解释一下这个键的用法吗?当在此密钥中存储某些内容很有用时,我找不到示例。有人可以点亮我吗:) 谢谢

<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:key="flight_columns_pref"
android:title="Flight Search Preferences"
android:summary="Set Columns for Search Results">

<CheckBoxPreference
android:key="show_airline_column_pref"
android:title="Airline"
android:summary="Show Airline column" />

</PreferenceScreen>

【问题讨论】:

    标签: android android-xml android-preferences android-sharedpreferences


    【解决方案1】:

    PreferenceScreen 具有 key 属性,因为它是 Preference 的子类。当您想以编程方式管理它时,它可能很有用,例如隐藏它或添加/隐藏子项。

    【讨论】:

      猜你喜欢
      • 2021-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多