创建自动滚动无限列表视图xamarin

时间:2016-04-12 05:41:11

标签: c# listview xamarin.android

我需要使用listview创建一个自动滚动无限列表,一旦列表结束,它将再次加载第一个项目。 现在我到目前为止尝试的是通过在适配器的数量中设置整数最大值来创建无限列表,如下所示:

line-height

现在,我的列表视图会在弹出窗口中打开。所以,我通过创建一个新的类&创建了一个Runnable线程。在listview.Post()方法中传递它的新对象以自动滚动它:

this.passengerNameList.Post(new AutoScrollList(this,this.passengerNameList));

&安培;我的自动滚动类是:

public class AutoScrollList:Java.Lang.Object,Java.Lang.IRunnable {

public override int Count
{
  get
     {
       int count = this.passengerNames.Count > 2 ? int.MaxValue :this.passengerNames.Count;
       return count;
     }
}

私人ListView passengerList;

private readonly TaskFragment fragment;

}

现在,当我尝试打开它时,UI挂起&如果我将最大值更改为某个随机数,如400,那么它可以工作,但这并不能解决我的目的。 任何人都可以告诉我,如果我做得对吗? 任何帮助表示赞赏。 提前谢谢......

0 个答案:

没有答案