前进的ListView下一个项目/ setSelectionFromTop不工作/禁止用户滚动的ListView [英] Advance ListView next item / setSelectionFromTop not working / Inhibit user scrolling ListView

查看:182
本文介绍了前进的ListView下一个项目/ setSelectionFromTop不工作/禁止用户滚动的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下午好

我有一个展示的项目列表的列表视图...好不是所有的人,但他们都在那里。而不是让用户向上/向下滚动的规定要求和上/下按钮。我把一切都处理得很好EXCEPT如何推进的ListView。说我在列表中寻找项目3。用户点击下一个......我想ListView的前进到第4项。我跟踪内部他们是对递增/递减的页面。我期待找到这样的事情,但没有骰子。

I have a list view that show a list of items...well not all of them but they are all there. Rather than let the user scroll up / down the requirement asks for and up / down buttons. I have everything handled quite well EXCEPT how to advance the ListView. Say I'm looking at item 3 in the list. The user hits next...I want to ListView to advance to item 4. I am keeping track internally of which page they are on for incrementing / decrementing. I was expecting to find something like this but no dice.

ListView.MoveNext();

ListView.Move(int);

每布雷登的建议,我试图在这里接受的解决方案:滚动到一个位置一个ListView ,它并未以滚动列表,即....它停留在第一个列表项。我也试过setSelection。

Per Brayden's suggestion I tried the accepted solution here: Scroll to a position in a listView and it did not APPEAR to scroll the list....i.e. it stayed on the first list item. I also tried setSelection.

下面是我的code:

public void btn_NextClick(View vw_Current) 
{
    //increment page count 1
    i_PageTracker ++;

    //advance to next record
    //int x = lstvw_LiftData.getFirstVisiblePosition();
    View v = lstvw_LiftData.getChildAt(0);
    int top = (v == null) ? 0 : v.getTop();

    lstvw_LiftData.setSelectionFromTop(i_PageTracker, top);
    //lstvw_LiftData.setSelection(i_PageTracker);
 }

基于普京的成功和我缺乏其我想提供,我认为一些额外的信息无关,但....

Based upon Vladimir's success and my lack thereof I wanted to provide some additional info that I thought irrelevant but....

我已经延长了SimpleAedapter并覆盖getView。我也有一个DataBinder的从数据对象填充某些数据TextViews

I've extended the SimpleAedapter and override the getView. I also have a DataBinder to populate TextViews with certain data from the data object.

有趣的是,当我在DataAdapter的getView和负载粘结剂的setViewValue设置一个断点,我们打他们为宜。然而在单击下一步按钮,当我们不打他们,这要是名单推进到下一个位置我希望....嗯我不知道....我有另一个想法....就回来。

Interestingly when I set a breakpoint in the getView of the DataAdapter and the setViewValue of the binder at load we hit them as appropriate. However when the next button is clicked we do not hit them which I would expect if the list was advancing to the next position....hmmmm I wonder....I have another Idea....be right back.

我理解了它....但我不知道该怎么办才好。见不知道我在做什么,我拍我自己。我只希望看到列表中的一个项目在一个时间,我不希望用户能够滚动。那么我做了什么来实现这一目标是覆盖在getCount将DataAdapter的并返回1。这似乎是答案只有一个项目显示爽!但随后覆盖getCount将也意味着,只有一个项目显示,所以我们永远前进......没有什么前进到。

I figured it out....but I don't know what to do about it. See not knowing what I am doing I shot myself. I ONLY want to see one item in the list at a time and I don't want the user to be able to scroll. Well what I did to accomplish that was to override getCount in the DataAdapter and return a 1. This SEEMED to be the answer as only one item displayed cool! But then overriding getCount also means there is only one item to display so we never advance...there's nothing to advance to.

所以我想知道这是什么。如何保持用户从能够滚动,迫使他们使用导航按钮。难道我处理滚动事件,并返回null?

So what I want to know is this. How do I keep the user from being able to scroll and force them to use the navigation button. Do I handle the scroll event and return null?

推荐答案

我理解了它....但我不知道该怎么办才好。见不知道我在做什么,我拍我自己。我只希望看到列表中的一个项目在一个时间,我不希望用户能够滚动。那么我做了什么来实现这一目标是覆盖在getCount将DataAdapter的并返回1。这似乎是答案只有一个项目显示爽!但随后覆盖getCount将也意味着,只有一个项目显示,所以我们永远前进......没有什么前进到。

I figured it out....but I don't know what to do about it. See not knowing what I am doing I shot myself. I ONLY want to see one item in the list at a time and I don't want the user to be able to scroll. Well what I did to accomplish that was to override getCount in the DataAdapter and return a 1. This SEEMED to be the answer as only one item displayed cool! But then overriding getCount also means there is only one item to display so we never advance...there's nothing to advance to.

所以我想知道这是什么。如何保持用户从能够滚动,迫使他们使用导航按钮。难道我处理滚动事件,并返回null?

So what I want to know is this. How do I keep the user from being able to scroll and force them to use the navigation button. Do I handle the scroll event and return null?

这篇关于前进的ListView下一个项目/ setSelectionFromTop不工作/禁止用户滚动的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆