Mám nasledujúci problém, mám vlastný dialóg, kód je tu:
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();
}
na tp.Is24HourView(true);
mi dáva túto chybu, žiadne preťaženie pre metódu Is24HourView
, má 1 argumenty. v dialógovom okne mám a datepicker
a a timepicker
, tu je 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>
Ako môžem nastaviť TimePicker tak, aby zobrazoval 24-hodinový formát, momentálne zobrazuje 12-hodinový formát. Tiež som to vyskúšal tp.SetIs24HourView(true);
ale dostávam nasledujúce chyby:
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"
Som začiatočník v tomto, takže by som naozaj oceniť nejakú pomoc! Díky moc!
odpovede:
0 pre odpoveď č. 1Skúste vymeniť tp.Is24HourView(true);
do tp.SetIs24HourView((Java.Lang.Boolean)(true));