I am using this library for creating switch toggle button.
I am wondering how could I change the text color which stayed behind. For more clear there is green switcher, the text is white, how could I change gray text which is not selectable. I couldn't find how to do this.
here is the style of mySwitch
<style name="mySwitchStyle">
<item name="switchTextAppearanceAttrib">#style/mySwitchTextAppearance</item>
<item name="pushStyle">false</item>
<item name="textOnThumb">true</item>
<item name="thumbExtraMovement">0dp</item>
<item name="thumbTextPadding">6dp</item>
<item name="trackTextPadding">6dp</item>
<item name="switchMinWidth">300dp</item>
<item name="switchMinHeight">36dp</item>
<item name="switchPadding">6dp</item>
</style>
<style name="mySwitchTextAppearance">
<item name="textColor">#color/white</item>
<item name="textSize">28sp</item>
<item name="textStyle">normal</item>
</style>
Use the function setTextColor(int), Documentation Link here
Related
As title, I need to change my app start up background color. Actually, is full white, and need to be #202030
I tried with
<item name="android:windowBackgroundColor">#202030</item>
in my style.xml but it's full black, no matters what color I set to this attribute.
Also, I can't use directly
<item name="android:backgroundColor>#202030</item>
because I will get also Cut/Copy/Paste background menu with this color and text in black
This is my style:
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="android:windowBackground">#202030</item>
<item name="colorAccent">#1E88E5</item>
<item name="android:navigationBarColor">#202030</item>
<item name="android:statusBarColor">#1d1d30</item>
<item name="android:textColorPrimary">#E0E0E0</item>
<item name="android:timePickerStyle">#style/TimePickerStyleLight</item>
<item name="android:fontFamily">#font/product_sans_regular</item>
<item name="android:textColor">#E0E0E0</item>
<item name="android:colorControlHighlight">#3399ff</item>
<item name="android:colorControlActivated">#3399ff</item>
<item name="alertDialogStyle">#style/AppCompatAlertDialogStyle</item>
<item name="android:textColorHint">#BDBDBD</item>
</style>
In your colors.xml
add
<color name="splash_color">#202030</color>
then in style.xml add splash_color to your theme.
<item name="android:windowBackground">#color/splash_color</item>
to create your custom color in Android Studio, you can add you color in past Values->Color->then put you line color that you want.
step-one
Then, you can go in you xml background color and add in your layout, just as simple
step-two
i hope that i can help, if this is not your aswer, comment here and explain more what you want.
I used account kit by facebook and I am unable to find the background color for country code picker. It shows black color don't know.
Sharing my app theme.
<style name="AppLoginTheme" parent="Theme.AccountKit">
<item name="com_accountkit_primary_color">#color/colorPrimary</item>
<item name="com_accountkit_primary_text_color">#color/colorWhite</item>
<item name="com_accountkit_secondary_color">#color/colorAccent</item>
<item name="com_accountkit_secondary_text_color">#color/colorTextSecondary</item>
<item name="com_accountkit_status_bar_color">#color/colorPrimaryDarkL</item>
<item name="com_accountkit_background_color">#color/colorOverlay</item>
<item name="com_accountkit_input_background_color">#color/colorWhite</item>
<item name="com_accountkit_input_border_color">#color/colorPrimary</item>
<item name="com_accountkit_button_disabled_background_color">#color/colorAccent</item>
<item name="com_accountkit_button_disabled_border_color">#color/colorAccent</item>
<item name="com_accountkit_button_background_color">#color/colorPrimary</item>
<item name="com_accountkit_button_text_color">#android:color/white</item>
<item name="com_accountkit_icon_color">#color/colorPrimary</item>
<item name="com_accountkit_background">#drawable/ak_background</item>
<item name="com_accountkit_toolbar_elevation">8dp</item>
</style>
The background color of country code selector will be same as the background color of the whole screen.
So to make it look better you'll have to change the com_accountkit_input_accent_color to white or some other color.
I building an application that uses ActionBarSherlock. I won't use ActionbarCompat so please focus on my question.
I made some code that can change the title color, as well as the subtitle color on the ActionBar. However when using my styles.xml for v21+ it will override those colors with the stock white colors (provided in Theme.Material)
Now I want to ask; what do I have to change in my code below to actually remove the Theme.Material colors override?
-EDIT
I noticed that it is working only when using a TextView in the Actionbar, however that's not what I want.
<style name="Theme.App.NoLight" parent="#android:style/Theme.Material">
<item name="android:colorAccent">#color/abs__holo_blue_light</item>
<item name="android:colorPrimary">#color/dark_holo</item>
<item name="android:logo">#android:color/transparent</item>
<item name="android:windowBackground">#color/dark_holo</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="android:actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="android:actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="android:homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
<item name="logo">#android:color/transparent</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
</style>
Hi There,
I am new to Android programming and using Android studio for my development.
As you can see from the screenshot, I've got a "refresh icon" but it is more of a gray color and I want to make it white. Here is my style. There is no gray color used in the style and I don't know which item I should use to override its gray color.. Please help!
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="popupMenuStyle">#style/PopupMenu.Coin</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Coin</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Coin</item>
<item name="actionDropDownStyle">#style/DropDownNav.Coin</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Coin</item>
<item name="actionModeBackground">#drawable/cab_background_top_coin</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_coin</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="ActionBar.Solid.Coin" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_coin</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_coin</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_coin</item>
<item name="progressBarStyle">#style/ProgressBar.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="ActionBar.Transparent.Coin" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="background">#drawable/ab_transparent_coin</item>
<item name="progressBarStyle">#style/ProgressBar.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
Consider using something like Android Asset Studio to create an icon with the desired opacity.
They already have a bunch of free to use (CCA 3.0) icons (including the same refresh icon you're using) and you can easily modify the opacity by modifying the opacity controller next to the 'Custom color' option.
I am currently making an app (Android 1.6) that can change between two different themes.
I made a custom theme that takes the Android light theme as a parent!
The trouble is that when I switch to white theme my text is not drawn but if I select something I can see the text. Furthermore when I switch themes my titleText, previous and next are the same as in my dark theme.
Here is the code I use for the theme:
<style name="Theme.White" parent="android:Theme.Light">
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>
<item name="textPrev">#style/text_prev</item>
<item name="textRegular">#style/text_regular</item>
<item name="textTitle">#style/text_title</item>
<item name="textNext">#style/text_next</item>
<item name="pageBack">#style/page_back</item>
<item name="whiteBack">#style/white_back</item>
<item name="android:textColorPrimaryInverse">#android:color/primary_text_light</item>
</style>
</resources>
This is my style:
<style name="text_prev">
<item name="android:textColor">#color/text_color</item>
</style>
<style name="text_next">
<item name="android:textColor">#color/default_text_color_2</item>
</style>
<style name="text_regular">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="text_title">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="page_back">
<item name="android:background">#drawable/white_background</item>
</style>
<style name="white_back">
<item name="android:background">#drawable/white_container</item>
<item name="android:padding">10sp</item>
</style>
I use two more resources that are in my res/drawable folder. Everything works fine in the standard theme, but as soon as I switch to my light theme my text disappears.
Is there something that I'm doing wrong?
From your code snippet above you're setting both background and text to the same color i.e. "color/text_color_dark", these should be different.
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>