roomorama / Caldroid

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

How can i change cell color? #445

Open marcosgarciagarcia202 opened 7 years ago

marcosgarciagarcia202 commented 7 years ago

I want to change the cell color like this:

ColorDrawable green = new ColorDrawable(Color.GREEN); for (Entrenamiento e : temporada.getEntrenamientos()) { caldroidFragment.setBackgroundDrawableForDate(green, e.getFecha()); }

caldroidFragment.refreshView();

But it does nothing for me.

How can i change it?

Thanks

amorenew commented 7 years ago

@marcosgarciagarcia202 check my fork https://github.com/amorenew/Caldroid/blob/master/sample.png

marcosgarciagarcia202 commented 7 years ago

@amorenew this is only an image. but how can i do it?

i do that:

            caldroidFragment.setBackgroundDrawableForDate(new ColorDrawable(Color.GREEN), e.getFecha());
    caldroidFragment.refreshView();

but does not work for me.

amorenew commented 7 years ago

for only cells check these two files https://github.com/amorenew/Caldroid/blob/master/caldroid/src/main/res/drawable/cell_bg.xml and cellView.addCustomState in https://github.com/amorenew/Caldroid/blob/master/caldroid/src/main/java/com/roomorama/caldroid/CaldroidGridAdapter.java