在Alliance Calendar Component中,当我点击日期时,它会通过Toast显示点击日期的信息。有没有办法如何显示它显示在textview / edittext而不是Toast消息?这是在xamarin顺便说一句。谢谢
以下是联盟日历本身的代码。
[Activity (Label = "Alliance Calendar Demo", MainLauncher = true)]
public class CalendarDemoActivity : Activity
{
CustomCalendar CalendarControl;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
CalendarControl = FindViewById<CustomCalendar>(Resource.Id.CalendarControl);
CalendarControl.NextButtonText= "Next";
CalendarControl.PreviousButtonText= "Prev";
//CalendarControl.NextButtonVisibility= ViewStates.Invisible;
//CalendarControl.PreviousButtonStyleId = Resource.Drawable.default_dim_selector;
//CalendarControl.ShowOnlyCurrentMonth = true;
CalendarControl.ShowFromDate = new DateTime();
List<CustomCalendarData> customData = new List<CustomCalendarData>();
customData = new List<CustomCalendarData>
{
new CustomCalendarData(DateTime.Now.AddDays(2)),
new CustomCalendarData(DateTime.Now.AddDays(4)),
new CustomCalendarData(DateTime.Now.AddDays(-4))
};
CalendarControl.CustomDataAdapter = customData;
CalendarControl.OnCalendarMonthChange += CalendarControl_CalendarMonthChange;
CalendarControl.OnCalendarSelectedDate += CalendarControl_CalendarDateSelected;
}
private void CalendarControl_CalendarDateSelected(object sender, CalendarDateSelectionEventArgs e)
{
Toast.MakeText(this, e.SelectedDate.ToString(), ToastLength.Short).Show();
}
private void CalendarControl_CalendarMonthChange(object sender, CalendarNavigationEventArgs e)
{
if (e.MonthChange == CalendarHelper.MonthChangeOn.Next)
{
}
else if (e.MonthChange == CalendarHelper.MonthChangeOn.Previous)
{
}
}
}
答案 0 :(得分:0)
是。用不同的东西替换Toast的代码
private void CalendarControl_CalendarDateSelected(object sender, CalendarDateSelectionEventArgs e)
{
// do something here in response to date selection
// Toast.MakeText(this, e.SelectedDate.ToString(), ToastLength.Short).Show();
}
答案 1 :(得分:0)
TextView tv = findViewById<TextView>(Resource.Id.tv);
private void CalendarControl_CalendarDateSelected(object sender, CalendarDateSelectionEventArgs e)
{
tv.Text = e.SelectedDate.ToString();
}