Personalizar DatePicker/CalendarView

¿Hay alguna forma de personalizar el Selector de fechas y/o Vista de calendario such that only specified fields appear. For e.g. in one instance, I'd like to see the DatePicker appear with only the month field showing, in another, I want it to appear with all but the year showing.

I've looked at creating custom controls, but that's really too much. I'm looking for a simple way to extend the existing controls.

preguntado el 28 de agosto de 12 a las 08:08

1 Respuestas

sí,

XML attribute..

<DatePicker android:calendarViewShown="false"/>

Usando Java:

Deje que el DatePicker you created has id: d1 so the code follows:

DatePicker selectDate =(DatePicker) findViewById(R.id.d1);
selectDate.setCalendarViewShown(false);

si estas creando DatePicker dinamicamente:

DatePicker selectDate = new DatePicker(this);
selectDate.setCalendarViewShown(false);

respondido 14 mar '13, 06:03

Can anyone please tell me why am I downvoted... I guess this is correct answer and it works. - Veer Shrivastav

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.