[英]How to scroll Item of Horizontal Scrollview inside of display when Click?
我正在嘗試像 discreatescrollview 這樣在手機顯示屏內滾動 HorizontalView 的項目。
我正在嘗試這個
private final void focusOnView(final HorizontalScrollView scroll, final View view) {
new Handler().post(new Runnable() {
@Override
public void run() {
int vLeft = view.getLeft();
int vRight = view.getRight();
int sWidth = scroll.getWidth();
scroll.smoothScrollTo(((vLeft + vRight - sWidth) / 2), 0);
}
});
}
但它滾動到中心而不是它的孩子。
我正在嘗試添加這樣的按鈕...
我准備在這種情況下使用回收視圖,以便添加
1.snapHelper 捕捉物品 2.添加ItemAnimator並更改它很容易 3.將來添加新物品只是在數組中添加新的object 4.滾動 animation 非常流暢
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.