0

I am using Caldroid library for my project and I am using

args.putBoolean(CaldroidFragment.SQUARE_TEXT_VIEW_CELL, false);

to use my custom normal cell for month's days.

But when I am trying to set background for a current day, using,

if (caldroidFragment != null) {
        caldroidFragment.setBackgroundResourceForDate(R.drawable.current_date,
                minDate);
        caldroidFragment.setTextColorForDate(R.color.purple, minDate);
    }

I also try in normal_cell_view.xml

android:layout_height="50dp"

But it shows like

How to set it look proper ?

Axay Prajapati
  • 791
  • 5
  • 20

1 Answers1

1

I think you must use not setBackgroundResourceForDate. If you try to setResource - proportions of your drawable will not save. So when you initialize Bundle, change your "setBackgroundResourceForDate" to "setBackgroundDrawableForDate" : How it looks in my code in onCreate method:

caldroidFragment = new CaldroidFragment();
Bundle args = new Bundle();
Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.your_drawable, null);
caldroidFragment.setBackgroundDrawableForDate(drawable, date);

Hope this helps!

  • can you please extend your answer with some useful links or just to make it a bit more informative? To me it seem the code is almost the same as in the question itself... so please, elaborate where was the issue. – Farside Apr 25 '16 at 13:18
  • extends a little bit :) – Ruslan Korostik Apr 25 '16 at 14:07