本文整理汇总了Java中android.preference.SwitchPreference.setSummaryOn方法的典型用法代码示例。如果您正苦于以下问题:Java SwitchPreference.setSummaryOn方法的具体用法?Java SwitchPreference.setSummaryOn怎么用?Java SwitchPreference.setSummaryOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.SwitchPreference
的用法示例。
在下文中一共展示了SwitchPreference.setSummaryOn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSwitchPreferenceBasedOnCheckBoxPreference
import android.preference.SwitchPreference; //导入方法依赖的package包/类
static void addSwitchPreferenceBasedOnCheckBoxPreference(final CheckBoxPreference checkBox,
final PreferenceGroup group) {
final SwitchPreference switchPref = new SwitchPreference(checkBox.getContext());
switchPref.setTitle(checkBox.getTitle());
switchPref.setKey(checkBox.getKey());
switchPref.setOrder(checkBox.getOrder());
switchPref.setPersistent(checkBox.isPersistent());
switchPref.setEnabled(checkBox.isEnabled());
switchPref.setChecked(checkBox.isChecked());
switchPref.setSummary(checkBox.getSummary());
switchPref.setSummaryOn(checkBox.getSummaryOn());
switchPref.setSummaryOff(checkBox.getSummaryOff());
switchPref.setSwitchTextOn(EMPTY_TEXT);
switchPref.setSwitchTextOff(EMPTY_TEXT);
group.addPreference(switchPref);
switchPref.setDependency(checkBox.getDependency());
}
示例2: build
import android.preference.SwitchPreference; //导入方法依赖的package包/类
/**
* Builds a SwitchPreference object
*/
@Override
public Preference build() {
SwitchPreference preference = null;
preference = build(SwitchPreference.class, true);
preference.setChecked((boolean) mDefaultValue);
preference.setSummaryOn((String)
getOptionalAttribute(TweakableBoolean.BUNDLE_ON_SUMMARY_KEY));
preference.setSummaryOff((String)
getOptionalAttribute(TweakableBoolean.BUNDLE_OFF_SUMMARY_KEY));
preference.setSwitchTextOn((String)
getOptionalAttribute(TweakableBoolean.BUNDLE_ON_LABEL_KEY));
preference.setSwitchTextOff((String)
getOptionalAttribute(TweakableBoolean.BUNDLE_OFF_LABEL_KEY));
return preference;
}
示例3: onCreate
import android.preference.SwitchPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
SwitchPreference replyPref = (SwitchPreference) findPreference(PREFERENCES_REPLY_LOCATION_REQUESTS_ALWAYS_KEY);
replyPref.setSummaryOn(getString(R.string.pref_summary_on_reply_location_request, SmsUpdateReceiver.MAGIC_SMS_BODY));
replyPref.setSummaryOff(getString(R.string.pref_summary_off_reply_location_request, SmsUpdateReceiver.MAGIC_SMS_BODY));
findPreference(PREFERENCES_SMS_LIMIT_KEY).setSummary(getSmsLimitSummary());
}