How to set different drawables in same selector
See original GitHub issueI need a custom selector for range selection in which I could set different drawables if the date is the first selected, last selected, or in the middle. Since the decorator doesn’t expose current date in decorate
how can I achieve that. Cheers!
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top Results From Across the Web
How to set same drawable selector xml for more than 2 views
I use the following code in my project for many buttons with the selector and other attributes that are the same.
Read more >Drawable resources - Android Developers
A StateListDrawable is a drawable object defined in XML that uses a several different images to represent the same graphic, depending on the ......
Read more >Drawables | CodePath Android Cliffnotes
Overview. A drawable resource is a general concept for a graphic that can be drawn to the screen. Drawables are used to define...
Read more >Android Drawable with Custom States | by Brian Terczynski
By using a StateListDrawable and defining custom states, we can easily show different images within the same View based on states that we...
Read more >Android Button Design, Custom Button, Round Button, Color
A selector is used to define a different behaviour for different states of the Button. What are drawable states? Each of the following...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s essentially all it is. I managed to find that code:
The color spans were to adjust text color from memory. It’s been a while since I’ve looked at this.
Left Drawable:
Middle drawable:
Right drawable:
See the
applyForSelection()
method in the earlier comment. Create theRangeSelectionDecorator
and keep a reference to it, then call that method whenever the selection changes on the calendar. It’s a bit of a misnomer as it’s really more of a helper class