Select a date using the yellow
DatePicker
.
See the date you selected and the date that is 280 days later.
Left, Samsung Galaxy S5.
Right, Nexus 5.
MainActivity.java
activity_main.xml
.
Each
TextView
and
CalendarView
is enclosed in a vertical
LinearLayout
.
The two vertical
LinearLayout
s
are enclosed in a horizontal
LinearLayout
.
strings.xml
:
unchanged.
res/values/dimens/dimens.xml
.
I added the
dimension
resource
margin
.
res/values-w820dp/dimens.xml
.
I added the
dimension
resource
margin
.
AndroidManifest.xml
build.gradle
(Module: app)
android.widget.DatePicker
platform_frameworks_base/core/java/android/widget/DatePicker.java
source code on GitHub
android.widget.CalendarView
platform_frameworks_base/core/java/android/widget/CalendarView.java
source code on GitHub
java.util.Calendar
DatePicker
occupies a lot of space on the screen.
To make it disappear after you have entered the date,
use a
DatePickerDialog
instead of a
DatePicker
.
See
Pickers.