当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceCategory类代码示例

本文整理汇总了Java中moe.shizuku.preference.PreferenceCategory的典型用法代码示例。如果您正苦于以下问题:Java PreferenceCategory类的具体用法?Java PreferenceCategory怎么用?Java PreferenceCategory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PreferenceCategory类属于moe.shizuku.preference包,在下文中一共展示了PreferenceCategory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addItem

import moe.shizuku.preference.PreferenceCategory; //导入依赖的package包/类
private void addItem (boolean value, Preference.OnPreferenceChangeListener listener
        , CharSequence title, PreferenceCategory parent) {
    SwitchPreferenceCompat preference = new SwitchPreferenceCompat(getActivity(),
            null, moe.shizuku.preference.R.attr.switchPreferenceStyle,
            R.style.Preference_SwitchPreferenceCompat);
    preference.setOnPreferenceChangeListener(listener);
    preference.setTitle(title);
    preference.setChecked(value);
    parent.addPreference(preference);
}
 
开发者ID:Trumeet,项目名称:MiPushFramework,代码行数:11,代码来源:ManagePermissionsActivity.java

示例2: onCreatePreferences

import moe.shizuku.preference.PreferenceCategory; //导入依赖的package包/类
@Override
public void onCreatePreferences(Bundle bundle, String s) {
    getPreferenceManager().setDefaultPackages(new String[]{BuildConfig.APPLICATION_ID + "."});

    getPreferenceManager().setSharedPreferencesName("settings");
    getPreferenceManager().setSharedPreferencesMode(Context.MODE_PRIVATE);

    setPreferencesFromResource(R.xml.settings, null);

    ListPreference listPreference;
    listPreference = (ListPreference) findPreference("drop_down2");
    listPreference.setEntries(new CharSequence[]{"Item 1", "Item 2"});
    listPreference.setEntryValues(new CharSequence[]{Locale.CHINESE.toString(), Locale.ENGLISH.toString()});
    if (listPreference.getValue() == null) {
        listPreference.setValueIndex(1);
    }
    listPreference.setOnPreferenceChangeListener(this);

    listPreference = (ListPreference) findPreference("drop_down3");
    listPreference.setEntries(new CharSequence[]{"Vertical align selected item", "(。>﹏<。)", "(っ╹ ◡ ╹ )っ\uD83D\uDC8A\uFEFF ヽ(✿゚▽゚)ノ", "⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄"});
    listPreference.setEntryValues(new CharSequence[]{"0", "1", "2", "3"});
    if (listPreference.getValue() == null) {
        listPreference.setValueIndex(2);
    }
    listPreference.setOnPreferenceChangeListener(this);

    findPreference("drop_down4").setOnPreferenceChangeListener(this);

    listPreference = (ListPreference) findPreference("drop_down5");
    listPreference.setEntries(new CharSequence[]{"This is a very long item. It will use a simple dialog if its text may wraps to more than one line", "Don't put too many item when use simple dialog", "(<ゝω・)☆"});
    listPreference.setEntryValues(new CharSequence[]{"0", "1", "2"});
    if (listPreference.getValue() == null) {
        listPreference.setValueIndex(2);
    }
    listPreference.setOnPreferenceChangeListener(this);

    PreferenceCategory preferenceCategory = new PreferenceCategory(getContext());
    preferenceCategory.setTitle("Test add dynamically");
    getPreferenceScreen().addPreference(preferenceCategory);

    CheckBoxPreference checkBoxPreference = new CheckBoxPreference(getContext());
    checkBoxPreference.setTitle("Test");
    checkBoxPreference.setSummaryOn("ON");
    checkBoxPreference.setSummaryOff("OFF");
    getPreferenceScreen().addPreference(checkBoxPreference);
}
 
开发者ID:RikkaW,项目名称:MaterialPreference,代码行数:47,代码来源:SettingsFragment.java


注:本文中的moe.shizuku.preference.PreferenceCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。