What is the best way to accomplish textView scrolling inside listview when it doesn't fit and only when specific row inside listview is selected. 另外,我希望我的文本从左侧滚动到右侧,当它到达末尾时从右侧向后滚动到左侧(不像选框那样默认)
ListView 行的 XML:
<TextView
android:id="@+id/txtWouldLikeToScroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:textColor="#fff"
android:textStyle="bold"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
/>
我正在使用自定义 ListViewAdapter 并覆盖滚动侦听器:
myList.setOnScrollListener(new OnScrollListener() {
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// TODO Auto-generated method stub
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
case OnScrollListener.SCROLL_STATE_IDLE:
view.setSelection(positionWhereIwouldLikeToPointSelection);
break;
case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
break;
case OnScrollListener.SCROLL_STATE_FLING:
break;
}
}
});
}
我想我必须设置要选择的文本视图(我在 ListView 中设置选择的那个),并且不知道如何覆盖选取框行为。
谢谢