I am very new to Android Studio. As a beginner I have created a simple app just for testing purpose and to view the appearance of Android studio material theme. I am currently working with latest version ie. L preview - Studio 0.8.2 version.
Here, I have just created textview, edittext, radio buttons and checkboxes. When I select male or female, it appears sky blue color. Could I be able to change sky blue color as a green or yellow color?
I do not know what is the name for that. From the picture can able to see edittext, radio buttons and checkboxes selected state as a sky blue color. When I try to click or select anything then those checkboxes or radio buttons need to change from default color to other colors like green or yellow!
In res/values/styles.xml,
<resources>
<!-- Base application theme. -->
<color name="custom_theme_color">#b0b0ff</color>
<style name="CustomTheme" parent="android:Theme.Material">
<item name="android:colorBackground">@color/custom_theme_color</item>
</style>
</resources>
In Android Studio Manifest.xml,
android:theme="@style/CustomTheme" >
Is there any other possible to change from default sky blue color to green or yellow or purple?
Is there any other way to change default sky blue color theme to other colors like pink or green?
How could I do this?
In res/values-v21/styles.xml,
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<item name="android:colorAccent">@color/custom_theme_color</item>
<item name="android:colorPrimaryDark">@color/custom_theme_color</item>
<item name="android:colorPrimary">@color/custom_theme_color</item>
</style>
The above code is simple and working well. In Android studio, it could be able to change from default sky blue color to any other colors like pink or green!
Create 3 files under xml ie. res/xml such as checked.xml, unchecked.xml and custom_checkbox.xml
checked.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2px" android:color="#FF00FF" />
<size android:height="20dp" android:width="20dp"/>
</shape>
unchecked.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="2px" android:color="#ffc0c0c0" />
<size android:height="20dp" android:width="20dp"/>
</shape>
custom_checkbox.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@xml/checked" />
<item android:state_pressed="true"
android:drawable="@xml/checked" />
<item android:drawable="@xml/unchecked" />
</selector>
From above second method, it (customized file) also could be able to create any shapes and colors based on our requirements. Even we can be able to customize the style, shapes and themes for a widget by using 2nd method.
Above two methods are working fine for me!