本文整理匯總了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());
}