I'm trying to "recolor" some controls in my application. Using an online theme generator I've created a theme I need and placed all of its files to my app project folders. When I preview an activity in IntelliJ IDEA Design perspertive - everything is ok. But on emulator or on the real device I can see only default colors.
Here is activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="vagafonova.ru.app.test"
android:background="@android:color/black">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="@+id/checkBox"
android:theme="@style/myTheme_cb"
android:checked="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Here is themes_mytheme_cb.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated with http://android-holo-colors.com -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="myTheme_cb" parent="Theme.mytheme">
<item name="android:checkboxStyle">@style/CheckBoxmyTheme_cb</item>
</style>
</resources>
Here is styles_mytheme_cb.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CheckBoxmyTheme_cb" parent="android:Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/mytheme_cb_btn_check_holo_dark</item>
</style>
</resources>
Here is mytheme_cb_btn_check_holo_dark
<item android:state_checked="true" android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_on_pressed_holo_dark" />
<item android:state_checked="false" android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_off_pressed_holo_dark" />
<item android:state_checked="true" android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_on_focused_holo_dark" />
<item android:state_checked="false" android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_off_focused_holo_dark" />
<item android:state_checked="false"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_off_holo_dark" />
<item android:state_checked="true"
android:state_enabled="true"
android:drawable="@drawable/mytheme_cb_btn_check_on_holo_dark" />
<!-- Disabled states -->
<item android:state_checked="true" android:state_window_focused="false"
android:drawable="@drawable/mytheme_cb_btn_check_on_disabled_holo_dark" />
<item android:state_checked="false" android:state_window_focused="false"
android:drawable="@drawable/mytheme_cb_btn_check_off_disabled_holo_dark" />
<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/mytheme_cb_btn_check_on_disabled_focused_holo_dark" />
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/mytheme_cb_btn_check_off_disabled_focused_holo_dark" />
<item android:state_checked="false" android:drawable="@drawable/mytheme_cb_btn_check_off_disabled_holo_dark" />
<item android:state_checked="true" android:drawable="@drawable/mytheme_cb_btn_check_on_disabled_holo_dark" />
There is no error or warnings while compilation, all the images are exist. On the preview screen i can see the right color for my ckeckbox, but always default colors and again no mistakes on my device or on the emulator. So, what is wrong?
0 comments:
Post a Comment