Closed rgk1221 closed 7 years ago
First create your own view class which extends BaseCellView
, implement required functions.
Then create a layout xml, use the class created in step one as the root node of it.
`public class DateCellView extends BaseCellView {
TextView id_cell_text;
public DateCellView(Context context) {
super(context);
}
public DateCellView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setDisplayText(DayData day) {
id_cell_text= (TextView) this.findViewById(R.id.id_cell_text);
id_cell_text.setText(day.getText());
}
}`
See. I have created the class same as you have created. ---> " use the class created in step one as the root node of it." WHAT YOU MEAN BY THIS. I CAN'T UNDERSTAND. i am an amateaur. please help me out with this.
calendarView.setDateCell(R.layout.layout_date_cell) I have also done this as you have done in your code
<?xml version="1.0" encoding="utf-8"?> <your.package.DateCellView xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="100dp" android:layout_height="100dp" android:background="#00ADA3"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="#FFFFFF" android:id="@+id/id_cell_text"/> </your.package.DateCellView>
Also, don't shout.
Hehe. thankyou soo much for your help.
Please i need one more help. when i implemented the datecellview as we discussed, all its styling and sizes changed. Now before implementing this thing the calendar was looking pretty attractive but now because i implemented the view all its styling is gone. i just wanted to change the text color of the dates. I was successful in changing the textcolor but then now its looking very ugly. So is there any way i could change only the textcolor of the dates and have the previous calendar with only its textcolor changed????
You should copy or modify my code.
for example.
Or, you should "styling" your own date cell xml.
I have tried doing it by setDateCell() method. And i have taken your code as it is. I get an error : android.view.InflateException: Binary XML file line #3: Binary XML file line #3: Error inflating class sun.bob.mcalendarviewtest.DateCellView. Help me change the text color.