本文整理汇总了C#中RecyclerView.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# RecyclerView.GetType方法的具体用法?C# RecyclerView.GetType怎么用?C# RecyclerView.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLastVisibleItem
private int GetLastVisibleItem(RecyclerView.LayoutManager layoutManager)
{
if (layoutManager is StaggeredGridLayoutManager)
return (layoutManager as StaggeredGridLayoutManager).FindLastVisibleItemPositions(null).Max();
if (layoutManager is LinearLayoutManager)
return (layoutManager as LinearLayoutManager).FindLastVisibleItemPosition();
if (layoutManager is GridLayoutManager)
return (layoutManager as GridLayoutManager).FindLastVisibleItemPosition();
throw new InvalidOperationException($"Can't find last item from {layoutManager.GetType().Name}");
}
示例2: OnBindViewHolder
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
{
if (holder.GetType () == typeof(MyHealth_BodyWeight_ViewHolder)) {
MyHealth_BodyWeight_ViewHolder vh = holder as MyHealth_BodyWeight_ViewHolder;
vh.tvMHBWCLIDateTime.Text = mData [position].mDateTime;
vh.tvMHBWCLIWeight.Text = mData [position].mWeight;
vh.tvMHBWCLINettWeight.Text = mData [position].mNettWeight;
vh.tvMHBWCLIBMI.Text = mData [position].mBMI;
vh.tvMHBWCLIBoneMass.Text = mData [position].mBoneMass;
vh.tvMHBWCLIFat.Text = mData [position].mFat;
}
}
示例3: OnBindViewHolder
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
{
if (holder.GetType () == typeof(MySoal_PetiMasuk_ViewHolder)) {
MySoal_PetiMasuk_ViewHolder vh = holder as MySoal_PetiMasuk_ViewHolder;
vh.tvTitle.Text = mData [position].title;
vh.tvContent.Text = mData [position].content;
}
//vh.IVLike.SetImageResource (mData[position].like);
}
示例4: OnBindViewHolder
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
{
if (holder.GetType () == typeof(MyVote_ViewHolder)) {
var vh = holder as MyVote_ViewHolder;
string tempURL = mVoteData [position].imageString;
//call the local picasso function
//set a tag for the button to the current clicked position
vh.IVDetail.SetTag (Resource.Id.ivDetails, position);
vh.IVPoster.SetTag (Resource.Id.ivPoster, position);
vh.IVVote.SetTag (Resource.Id.ivVote, position);
vh.PBimgVote.Visibility = ViewStates.Invisible;
intialButton (vh.IVVote, vh.PBimgVote, mVoteData [position].voteStat);
PicassoSetImage (tempURL, vh.IVPoster, vh);
//define a handle click
vh.IVVote.Click += IVVote_Click;
vh.IVDetail.Click += IVDetail_Click;
vh.IVPoster.Click += IVPoster_Click;
vh.TVLike.Visibility = ViewStates.Invisible;
vh.IVDetail.Visibility = ViewStates.Invisible;
}
}
示例5: OnBindViewHolder
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
{
((CardBaseViewHolder) viewHolder).Title.SetText(Data[position].Title, TextView.BufferType.Normal);
((CardBaseViewHolder) viewHolder).Description.SetText(Data[position].Description,
TextView.BufferType.Normal);
if (viewHolder.GetType() == typeof (CardImageViewHolder))
{
((CardImageViewHolder) viewHolder).LoadImage(((FeedItemImage) Data[position]).Image, context);
}
else if (viewHolder.GetType() == typeof (CardPercentViewHolder))
{
((CardPercentViewHolder) viewHolder).AnimatePercentage(
((FeedItemPercentage) Data[position]).Percentage, 1200);
}
else if (viewHolder.GetType() == typeof (CardGraphViewHolder))
{
PlotModel model = ((FeedItemGraph) Data[position]).CreatePlotModel();
((CardGraphViewHolder) viewHolder).PlotGraph(model);
}
else if (viewHolder.GetType() == typeof (CardPersonViewHolder))
{
((CardPersonViewHolder) viewHolder).LoadData(((FeedItemUser) Data[position]).UserAccount, context);
}
else if (viewHolder.GetType() == typeof (CardActivityViewHolder))
{
((CardActivityViewHolder) viewHolder).LoadData((FeedItemActivity) Data[position], context);
}
else if (viewHolder.GetType() == typeof (CardRatingViewHolder))
{
((CardRatingViewHolder) viewHolder).RatingBar.Rating = ((FeedItemStarRating) Data[position]).Rating;
}
if (Data[position].Interaction == null || Data[position].Interaction.Type == FeedItemInteraction.InteractionType.None)
{
((CardBaseViewHolder) viewHolder).Interact.Visibility = ViewStates.Gone;
return;
}
((CardBaseViewHolder) viewHolder).Interact.Visibility = ViewStates.Visible;
((CardBaseViewHolder) viewHolder).Interact.Text = Data[position].Interaction.Label;
FeedItemInteraction interaction = Data[position].Interaction;
switch (interaction.Type)
{
case FeedItemInteraction.InteractionType.Url:
((CardBaseViewHolder) viewHolder).Interact.Click += delegate
{
Intent i = new Intent(Intent.ActionView,
Android.Net.Uri.Parse(interaction.Value));
context.StartActivity(i);
};
break;
case FeedItemInteraction.InteractionType.Assessment:
((CardBaseViewHolder) viewHolder).Interact.Click +=
delegate
{
int actId = int.Parse(interaction.Value);
if (!AndroidUtils.IsConnected() && !AndroidUtils.IsActivityAvailableOffline(actId, context))
{
AndroidUtils.OfflineAlert(context,
"This assessment has not been downloaded yet and requires an Internet connection to prepare!");
return;
}
try
{
Intent intent = new Intent(context, typeof(AssessmentActivity));
intent.PutExtra("ActivityId", actId);
context.StartActivity(intent);
}
catch (Exception ex)
{
AndroidUtils.OfflineAlert(context,
"Error launching assessment activity");
return;
}
};
break;
case FeedItemInteraction.InteractionType.Activity:
((CardBaseViewHolder) viewHolder).Interact.Click += delegate
{
int actId = int.Parse(interaction.Value);
if (!AndroidUtils.IsConnected() && !AndroidUtils.IsActivityAvailableOffline(actId, context))
{
AndroidUtils.OfflineAlert(context,
"This practiceActivity has not been downloaded yet and requires an Internet connection to prepare!");
return;
}
Intent intent = new Intent(context, typeof (ScenarioActivity));
intent.PutExtra("ActivityId", actId);
context.StartActivity(intent);
};
//.........这里部分代码省略.........
示例6: OnBindViewHolder
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
{
if (holder.GetType () == typeof(Product_ViewHolder)) {
DateTime dt = Convert.ToDateTime (prodList [position].created_at);
string ProdDate = dt.ToString ("MMM dd, yyyy");
var h = holder as Product_ViewHolder;
h.txtPrice.Text = prodList [position].price;
h.txtProdName.Text = prodList [position].title;
h.txtProdDate.Text = ProdDate;
h.View.SetTag (Resource.Id.recyclerView, Int32.Parse (prodList [position].id));
h.View.Click += Product_Click;
PicassoSetImage (prodList [position].url_photo_thumb, h.ImageView, h);
}
}