Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中的DatePicker日历视图_Android_Eclipse_Android Studio_Datepicker_Android Datepicker - Fatal编程技术网

android中的DatePicker日历视图

android中的DatePicker日历视图,android,eclipse,android-studio,datepicker,android-datepicker,Android,Eclipse,Android Studio,Datepicker,Android Datepicker,嗨,我有一些奇怪的问题。我正在尝试从android中的日期选择器中删除日历视图。正如stackoverflow中的大多数帖子所说,添加这一行: android:calenderViewShown="false" 但是当我添加这一行时,我得到了错误 错误:未找到属性“CalendarViewShowed”的资源标识符 在“安卓”软件包中 如果我试图通过使用此行的代码添加此内容 picker.setCalendarViewShown(false); 然后显示错误: 类型的方法SetCalenda

嗨,我有一些奇怪的问题。我正在尝试从android中的日期选择器中删除日历视图。正如stackoverflow中的大多数帖子所说,添加这一行:

android:calenderViewShown="false"
但是当我添加这一行时,我得到了错误

错误:未找到属性“CalendarViewShowed”的资源标识符 在“安卓”软件包中

如果我试图通过使用此行的代码添加此内容

picker.setCalendarViewShown(false);
然后显示错误:

类型的方法SetCalendarViewShowed(布尔)未定义 日期选择器

我的舱单条目是这样的

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <DatePicker
                android:id="@+id/schedule"
                android:calendarViewShown="false"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TimePicker
                android:id="@+id/timePicker1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <Button
                android:id="@+id/select"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Set Alarm" />
        </LinearLayout>
    </ScrollView>

</RelativeLayout>

我的完整XML代码如下

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23" />
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <DatePicker
                android:id="@+id/schedule"
                android:calendarViewShown="false"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TimePicker
                android:id="@+id/timePicker1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <Button
                android:id="@+id/select"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Set Alarm" />
        </LinearLayout>
    </ScrollView>

</RelativeLayout>


我已经尝试过清理并重新启动eclipse。但是没有用。我不明白真正的问题是什么!!有人能帮我吗?

试着使用android:datePickerMode=“spinner”。由于它是API21属性,请不要忘记在
res
文件夹中创建一个新的
layout-v21
文件夹

<DatePicker
    android:id="@+id/schedule"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:datePickerMode="spinner"
    android:calendarViewShown="false" />

denis\u lor
。。 请先尝试此代码

<DatePicker
    android:id="@+id/schedule"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:datePickerMode="spinner"
    android:calendarViewShown="false" />

希望它能有所帮助。

正如文件所说-

显示的公共void SetCalendarView(显示的是布尔值)

API级别11中添加的设置是否显示日历视图

注意:当 DatePicker\u datePickerMode属性设置为日历

参数show true显示日历视图,false隐藏日历视图

L之后,DatePicker\u datePickerMode的默认模式是calendar。因此,您必须确保选择了正确的模式


要隐藏日历视图,首先将datePickerMode设置为微调器,然后可以调用SetCalendarViewShowed(false)。

Oho现在可以工作了。现在显示对话框DatePicker.SetSpinnersShowed(true);dialogDatePicker.SetCalendarViewShowed(false)正在运行。我还检查了Android工具>>添加支持库。但我不知道是什么造成了这个恶作剧。不管怎样谢谢Raghav MehtaAnytime伙计。。很高兴它能帮助您D