我有以下问题,我有一个自定义对话框,代码在这里:
Button schedend = FindViewById<Button>(Resource.Id.buttonschede);
schedend.Click += schedend_Click;
}
void schedend_Click(object sender, EventArgs e)
{
Dialog dialog = new Dialog(this);
dialog.SetContentView(Resource.Layout.DateTimePickerTemplate);
dialog.SetTitle("Choose Date and Time");
TimePicker tp = FindViewById<TimePicker>(Resource.Id.timePicker1);
tp.Is24HourView(true);
dialog.Show();
}
这tp.Is24HourView(true);
给了我这个错误,方法没有重载Is24HourView
,需要 1 个参数。在对话框中,我有 adatepicker
和 a timepicker
,这是 axml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<DatePicker
android:id="@+id/datePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TimePicker
android:id="@+id/timePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
如何设置 timePicker 以显示 24 小时格式,它当前显示 12 小时格式。我也尝试过 tp.SetIs24HourView(true);
,但出现以下错误:
Error 1 The best overloaded method match for 'Android.Widget.TimePicker.SetIs24HourView(Java.Lang.Boolean)' has some invalid arguments
and
Error 2 Argument 1: cannot convert from 'bool' to 'Java.Lang.Boolean'
我是这方面的初学者,所以我真的很感激一些帮助!多谢!