不幸的是,我无法处理这个问题。更准确地说,在将 TextView 添加到 LinearLayout 后,marque 函数对我不起作用。如果我只是在视图中添加一个 TextView,它就可以正常工作。可能是什么问题呢?也许是 LinearLayout 本身的问题?txv_appointment 有问题。我的代码:
private void Calendar_InlineItemLoaded(object sender, InlineItemLoadedEventArgs e)
{
calendar_item = e.Date;
appointment = e.CalendarInlineEvent;
ContextThemeWrapper newContext = new ContextThemeWrapper(this, Resource.Style.textView_appointment);
txv_appointment = new TextView(newContext);
txv_appointment.Text = appointment.Subject;
if (tablet == true) { txv_appointment.TextSize = 24; }
else { txv_appointment.TextSize = 14; }
txv_appointment.SetSingleLine(true);
txv_appointment.Ellipsize = Android.Text.TextUtils.TruncateAt.Marquee;
txv_appointment.SetMarqueeRepeatLimit(10);
txv_appointment.Focusable = true;
txv_appointment.FocusableInTouchMode = true;
txv_appointment.SetHorizontallyScrolling(true);
txv_appointment.Selected = true;
if (theme == 0) { txv_appointment.SetTextColor(Color.White); } else { txv_appointment.SetTextColor(Color.Black); }
//e.View = txv_appointment;
LinearLayout ll1 = new LinearLayout(this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
ll1.LayoutParameters = lp;
ll1.Orientation = Orientation.Vertical;
ll1.AddView(txv_appointment);
LinearLayout.LayoutParams lp_textView2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
TextView txtView2 = new TextView(newContext);
txtView2.LayoutParameters = lp_textView2;
txtView2.Text = AppResources.ResourceManager.GetString("str_click");
ll1.AddView(txtView2);
e.View = ll1;
}