本文整理了Java中android.widget.Switch.getContext()
方法的一些代码示例,展示了Switch.getContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Switch.getContext()
方法的具体详情如下:
包路径:android.widget.Switch
类名称:Switch
方法名:getContext
暂无
代码示例来源:origin: square/assertj-android
public SwitchAssert hasOnText(int resId) {
isNotNull();
return hasOnText(actual.getContext().getString(resId));
}
代码示例来源:origin: square/assertj-android
public SwitchAssert hasOffText(int resId) {
isNotNull();
return hasOffText(actual.getContext().getString(resId));
}
代码示例来源:origin: googlesamples/android-WatchFace
public void setSharedPrefId(int sharedPrefId) {
mSharedPrefResourceId = sharedPrefId;
if (mUnreadNotificationSwitch != null) {
Context context = mUnreadNotificationSwitch.getContext();
String sharedPreferenceString = context.getString(mSharedPrefResourceId);
Boolean currentState = mSharedPref.getBoolean(sharedPreferenceString, true);
updateIcon(context, currentState);
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public SwitchAssert hasOffText(int resId) {
isNotNull();
return hasOffText(actual.getContext().getString(resId));
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public SwitchAssert hasOnText(int resId) {
isNotNull();
return hasOnText(actual.getContext().getString(resId));
}
代码示例来源:origin: googlesamples/android-WatchFace
public void setIcons(int enabledIconResourceId, int disabledIconResourceId) {
mEnabledIconResourceId = enabledIconResourceId;
mDisabledIconResourceId = disabledIconResourceId;
Context context = mUnreadNotificationSwitch.getContext();
// Set default to enabled.
mUnreadNotificationSwitch.setCompoundDrawablesWithIntrinsicBounds(
context.getDrawable(mEnabledIconResourceId), null, null, null);
}
代码示例来源:origin: xuancao/DynamicSkin
public static void setTint(@NonNull Switch switchView, @ColorInt int color, boolean useDarker) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
if (switchView.getTrackDrawable() != null) {
switchView.setTrackDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getTrackDrawable(), color, 0.5f, false, useDarker));
}
if (switchView.getThumbDrawable() != null) {
switchView.setThumbDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getThumbDrawable(), color, 1.0f, true, useDarker));
}
}
代码示例来源:origin: garretyoder/app-theme-engine
public static void setTint(@NonNull Switch switchView, @ColorInt int color, boolean useDarker) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
if (switchView.getTrackDrawable() != null) {
switchView.setTrackDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getTrackDrawable(), color, false, false, useDarker));
}
if (switchView.getThumbDrawable() != null) {
switchView.setThumbDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getThumbDrawable(), color, true, false, useDarker));
}
}
代码示例来源:origin: h4h13/RetroMusicPlayer
public static void setTint(@NonNull Switch switchView, @ColorInt int color, boolean useDarker) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) return;
if (switchView.getTrackDrawable() != null) {
switchView.setTrackDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getTrackDrawable(), color, false, false, useDarker));
}
if (switchView.getThumbDrawable() != null) {
switchView.setThumbDrawable(modifySwitchDrawable(switchView.getContext(),
switchView.getThumbDrawable(), color, true, false, useDarker));
}
}
内容来源于网络,如有侵权,请联系作者删除!