roomorama / Caldroid

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

I want to change the color of a cell (I've read other issues, and I couldn't get it) #401

Closed tlonist closed 8 years ago

tlonist commented 8 years ago

Thanks for wonderful library. Many thanks, Dao. Straight to the point, I want to customize the calendar cell to change its color upon making a click action. I get that in order to do so,

  1. Customize the caldroidadapter by extension
  2. Reflect the changes in caldroidFragment by extension
  3. Call customized caldroidFragment in the main Activity.

I am failing at the first step. I know I need to override the getView method, and here's my code.As a first step, I firstly just want to make all the calendar cells to be green.

LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View cellView = convertView;

    if (convertView == null)
    {
        cellView = inflater.inflate(R.layout.custom_cell, null);
    }
    cellView.setBackgroundResource(R.drawable.cell_background_green);
    return cellView;

Could you give me hints for doing so? It will be a great help for me. Thanks!

tlonist commented 8 years ago

I did it!!! Many thanks >_<