尝试使用DatePicker时不起作用 [英] DatePicker does not work when trying to use it
问题描述
可能重复:
找不到Android CalendarView类
将日期选择器放到我的布局中,而不是日期选择器,它仅显示: DatePicker
I tried putting a Date Picker in my layout but instead of the DatePicker it only shows: DatePicker
,并且此错误:
找不到以下类:
知道这是什么原因是因为我的应用程序中已经有一个DatePicker,并且它可以正常工作,只是不知道为什么现在不起作用。
-DatePicker(更改为android.widget.DatePicker,修复构建路径,编辑XML)
and this error:
The following classes could not be found:
- DatePicker (Change to android.widget.DatePicker, Fix Build Path, Edit XML)
I don't know what this is because I already have a DatePicker in my app and it works fine just don't know why this one now isn't working.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="HardcodedText" >
<TextView
android:id="@+id/tvNomeR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="@+id/tvDataR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<TextView
android:id="@+id/tvMensagemR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<DatePicker
android:id="@+id/datePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/bAdiarR"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Adiar" />
<Button
android:id="@+id/bResponderR"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Responder" />
</LinearLayout >
</LinearLayout>
推荐答案
我在图形布局中看到了您在说什么,但这不会影响您的应用。此错误仅表示Eclipse无法为您的布局构建DatePicker的预览。我敢打赌,如果您运行您的应用程序,它将显示正常。
I see what you are talking about in the Graphical Layout, but this won't affect your app. This error simply means Eclipse cannot build a preview of DatePicker for your layout. I bet if you run your app it will display just fine.
这篇关于尝试使用DatePicker时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!