roomorama / Caldroid

A better calendar for Android
Other
1.42k stars 532 forks source link

No method or Style to Alter Navigation Arrows Color #412

Closed RowlandOti closed 7 years ago

RowlandOti commented 8 years ago

I looked through the code and didn't find any method to change the colour of the red (default) navigation arrows. Also, I wasn't able to find any stylable attribute for achieving the same. How can it be done in the current state? @roomorama

ropopis commented 8 years ago

Hi! I have the same problem than you. I looked the code and I found (in style.xml) that each style has in drawable folder a xml file. I think that would be the unique solution: override this style and change it by yours. In the case of the left/right arrows, i found it as a image in drawable folder too. Then, you should change the color of the images (arrows) and in the style.xml create a new style (yours), based on the default style. I don't know if it is the better solution, but i didn't find another.

Also you can change it like @roomorama-dev explain in (on second paragraph): https://github.com/roomorama/Caldroid#allow-user-to-select-a-date-and-inform-listener

I hope it will be usefull for you! Cheers!

bigo132 commented 8 years ago

You can define your own theme to change the look and feel of Caldroid without having to subclass it. You should inherit from base theme CaldroidDefault. Here's how to create a dark theme:

<!-- Dark theme. -->
<style name="CaldroidDefaultDark" parent="CaldroidDefault">
    <item name="styleCaldroidLeftArrow">@style/CaldroidDefaultLeftButton</item>
    <item name="styleCaldroidRightArrow">@style/CaldroidDefaultRightButton</item>
</style>

<style name="CaldroidDefaultArrowButton">
    <item name="android:layout_width">30dp</item>
    <item name="android:layout_height">30dp</item>
</style>

<style name="CaldroidDefaultLeftButton" parent="CaldroidDefaultArrowButton">
    <item name="android:background">@drawable/left_arrow</item>
</style>

After creating your own theme, supply it to your Caldroid fragment:

Bundle args = new Bundle();
args.putInt(CaldroidFragment.THEME_RESOURCE, com.caldroid.R.style.CaldroidDefaultDark);
caldroidFragment.setArguments(args);
RowlandOti commented 7 years ago

All suggestions by @ropopis and @bigo132 work. thank you @bigo132 for clarifying with such a solid example. Cheers!