Last active
June 25, 2017 13:21
-
-
Save peterli888/fc5cad40c38ec80f71cda23853bc3839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
也许用 setTheme(android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); | |
内置多个颜色的主体 | |
file android\modules\ui\src\java\ti\modules\kotter\ui\widget\TiUISwitch.java | |
function protected void updateButton(CompoundButton cb, KrollDict d) { | |
if (d.containsKey("tcolor")) { | |
int ncolor=TiConvert.toColor(d, "tcolor"); | |
int xcolor=TiConvert.toColor(d, "xcolor"); | |
((SwitchCompat) cb).setSwitchMinWidth(300);//失败 看不见 | |
((SwitchCompat) cb).setSwitchPadding(300);//失败 看不见 | |
Log.checkpoint(TAG, "ncolor: " + ncolor + ", xcolor: " + xcolor+",RED="+Color.RED); | |
int disabledColor = 0; | |
int trackDisabledColor = 0; | |
if (cb instanceof SwitchCompat) { | |
Log.checkpoint(TAG, "SwitchCompat " ); | |
//if(disabledColor == 0) disabledColor = AttrUtils.getColorAttr(view.getContext(), R.attr.colorSwitchThumbNormal); | |
//if(trackDisabledColor == 0) trackDisabledColor = view.getContext().getResources().getColor(R.color.grey_600); | |
//((SwitchCompat) cb).setThumbTintList(colorToStateList(xcolor, disabledColor));//没有 | |
//((SwitchCompat) cb).setTrackTintList(colorToStateList(ncolor, trackDisabledColor));//没有 | |
//((SwitchCompat) cb).setThumbDrawable(new ColorDrawable(0-Color.RED));//看不见 | |
//((SwitchCompat) cb).setTrackDrawable(new ColorDrawable(0-Color.BLUE));//看不见 | |
//((SwitchCompat) cb).setShadowDrawable(new ColorDrawable(0-Color.RED)); | |
//((SwitchCompat) cb).setCoveredFadeColor(new ColorDrawable(0-Color.RED));//没有 | |
//((SwitchCompat) cb).setSliderFadeColor(new ColorDrawable(0-Color.BLUE));//没有 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment