列表视图项选择自动滚动到顶部?

时间:2015-08-25 14:14:41

标签: android listview

    </ListView>` 
    android:layout_width="fill_parent"
    android:layout_height="400dp"
    android:id="@+id/listview"
    android:paddingTop="51dp"
    android:divider="#00ffffff"
    android:dividerHeight="5dp"
    android:layout_weight="1"
    android:cacheColorHint="#006300ff"
    android:background="@drawable/sfando"
    android:longClickable="false"
    android:choiceMode="multipleChoice"
    android:fastScrollAlwaysVisible="false"
    android:touchscreenBlocksFocus="false">`

    public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {

            adapterView.requestFocusFromTouch();
             adapterView.setSelection(i);

           itemnum = view;
            return false;
        }
    });
listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
    view.setBackgroundResource(R.color. @Override
public void onNothingSelected(AdapterView<?> adapterView) {
    itemnum.setBackgroundColor(Color.TRANSPARENT);
}


        listView.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);

这是我的java代码,我不明白whi自动滚动? 谢谢,借口我糟糕的经历,但我是新的

......................................

0 个答案:

没有答案