AndRaGhu
AndRaGhu

Reputation: 161

Date picker is not displayed in the layout design?

date picker is not clear with it's own design

When i drag and drop the datepicker in the layout design It shows an error message like this,

The following classes could not be found:

What i have to do to solve this issue.

Upvotes: 2

Views: 3693

Answers (3)

taran mahal
taran mahal

Reputation: 1088

Just run the code, it will be visible on device. You can see it in XML also by just changing the xml target.

NOTE: You don't need to set the project target just the target in the graphical layout editor.

Upvotes: 0

MZA
MZA

Reputation: 91

Date picker will pop up just month, day, year set of fields with up and down arrows. It won't really work though, unless you create your own dynamic set and cancel buttons. Once you click one of them to bring up the keyboard, you cannot get rid of it. You'll likely want to use the full date picker widget.

To properly use the date picker, make a new one in your activity.java instead:

    new DatePickerDialog(MainActivity.this,
                d,
                dateAndTime.get(Calendar.YEAR),
                dateAndTime.get(Calendar.MONTH),
                dateAndTime.get(Calendar.DAY_OF_MONTH)).show();

Make that trigger from a button.

If you want to try what happens if you pull it out of the widget palette like you did, change the android target version to something like 10 and you might be able to see it. The errors you are getting are likely due to just the view you have in eclipse not being able to render them, not necessarily the widget itself. Also try to see if you can get it on a phone to look at it too.

Upvotes: 1

Prasanna
Prasanna

Reputation: 236

i think in your LinearLayout orientation is not set. set orientation to vertical for your layout.Other wise put your xml code

Upvotes: 0

Related Questions