1

I want to implement a calendar view into my application so that people can choose dates. I like this calendar view which is in the google Adsense app. enter image description here How can I implement something similar? I looked around and I couldn't find the name.

I tried multiple calendar librairies but none are this clean.

CSDev
  • 3,177
  • 6
  • 19
  • 37
Pierre
  • 97
  • 1
  • 7

2 Answers2

0

You can display calendar using DatePickerDialog class

DatePickerDialog is used to display date picker dialog to the users where the user can pick or select any date.

https://11zon.com/android/android_datepicker_dialog.php

0

You can use Datepicker like mentioned in this thread to achieve your wanted look.

Another solution that I can offer if you want to change the names inside the dialog is to use custom number picker like this:

You need to add NumberPicker into your XML:

<NumberPicker
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />

Create an array with your values(this will go to the number picker)

String mValues[] = { "100 ", "200" };

Now use this method to create number picker with custom values:

 private void setNubmerPicker(NumberPicker nubmerPicker,String [] numbers ){
    nubmerPicker.setMaxValue(numbers.length-1);
    nubmerPicker.setMinValue(0);
    nubmerPicker.setWrapSelectorWheel(true);
    nubmerPicker.setDisplayedValues(numbers);
}

And for the final step call this method:

setNubmerPicker(yourNumberPicker,mValues);
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53