Android Trick - select Gridview item and make the cell highlighted
As Title said, I am making a customized calendar view . For date part I am using Gridview. But after I set item background and using setSelection(int) I could not highlighted the item I selected. this is the drawable for cell view background. <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/bg_purple_round_corner" android:state_pressed="true"> <item android:drawable="@drawable/bg_purple_round_corner" android:state_checked="true"> <item android:drawable="@drawable/bg_purple_round_corner" android:state_selected="true"> <item android:drawable="@drawable/bg_white_round_corner" android:state_pressed="false"> </item></item></item></item></selector> This is the gridview codes: gvDates.setOnItemClickListener(new OnItemClickListener() { ...