Sen mesela android:switchTextAppearance
niteliğini, kullanmalıdır:
<style name="SwitchTextAppearance" parent="@android:style/TextAppearance.Holo.Small">
<item name="android:textColor">@color/my_switch_color</item>
</style>
da ayrıca stilleri yukarıda kullanarak, kodda yapabilirsiniz::
mySwitch.setSwitchTextAppearance(getActivity(), R.style.SwitchTextAppearance);
android:switchTextAppearance="@style/SwitchTextAppearance"
ve stillerde
... ve'ye gelince -ve Switch
sizin SwitchTextAppearance
tarzı bir textColor
Eğer setSwitchTextAppearance
yılında Switch
kaynak koduna kontrol edebilirsiniz sağlamaması halinde bu renk kullanılacaktır:
ColorStateList colors;
int ts;
colors = appearance.getColorStateList(com.android.internal.R.styleable.
TextAppearance_textColor);
if (colors != null) {
mTextColors = colors;
} else {
// If no color set in TextAppearance, default to the view's textColor
mTextColors = getTextColors();
}
ts = appearance.getDimensionPixelSize(com.android.internal.R.styleable.
TextAppearance_textSize, 0);
if (ts != 0) {
if (ts != mTextPaint.getTextSize()) {
mTextPaint.setTextSize(ts);
requestLayout();
}
}
kodunuzu sonrası .. –
hiçbir özel kod var Bu, kimliğiyle bulunan mizanpajtaki bir anahtardır. Ve kodda switch.setTextColor'u (Color.WHITE) ayarladım; –