本文整理了Java中android.widget.HorizontalScrollView.scrollTo()
方法的一些代码示例,展示了HorizontalScrollView.scrollTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HorizontalScrollView.scrollTo()
方法的具体详情如下:
包路径:android.widget.HorizontalScrollView
类名称:HorizontalScrollView
方法名:scrollTo
暂无
代码示例来源:origin: jiangqqlmj/FastDev4Android
@Override
public void run() {
mScrollBar.scrollTo(mScrollX, 0);
}
});
代码示例来源:origin: stackoverflow.com
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.ScrollView);
Button button = (Button) findViewById(R.id.btn5);
int x, y;
x = button.getLeft();
y = button.getTop();
hsv.scrollTo(x, y);
}
代码示例来源:origin: jiangqqlmj/FastDev4Android
@Override
public void run() {
mScrollBar.scrollTo(mScrollX,0);
}
});
代码示例来源:origin: stackoverflow.com
HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.ScrollView);
Button button = (Button) findViewById(R.id.btn5);
int x, y;
x = button.getLeft();
y = button.getTop();
hsv.scrollTo(x, y);
代码示例来源:origin: hackware1993/MagicIndicator
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (mAdapter != null) {
mNavigatorHelper.onPageScrolled(position, positionOffset, positionOffsetPixels);
if (mIndicator != null) {
mIndicator.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
// 手指跟随滚动
if (mScrollView != null && mPositionDataList.size() > 0 && position >= 0 && position < mPositionDataList.size()) {
if (mFollowTouch) {
int currentPosition = Math.min(mPositionDataList.size() - 1, position);
int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
PositionData current = mPositionDataList.get(currentPosition);
PositionData next = mPositionDataList.get(nextPosition);
float scrollTo = current.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
float nextScrollTo = next.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
mScrollView.scrollTo((int) (scrollTo + (nextScrollTo - scrollTo) * positionOffset), 0);
} else if (!mEnablePivotScroll) {
// TODO 实现待选中项完全显示出来
}
}
}
}
代码示例来源:origin: hackware1993/MagicIndicator
mScrollView.smoothScrollTo((int) (scrollTo), 0);
} else {
mScrollView.scrollTo((int) (scrollTo), 0);
mScrollView.smoothScrollTo(current.mLeft, 0);
} else {
mScrollView.scrollTo(current.mLeft, 0);
mScrollView.smoothScrollTo(current.mRight - getWidth(), 0);
} else {
mScrollView.scrollTo(current.mRight - getWidth(), 0);
代码示例来源:origin: stackoverflow.com
LinearLayout ll = (LinearLayout) findViewById(R.id.ll);
final HorizontalScrollView hsv = (HorizontalScrollView) findViewById(R.id.hsv);
OnGlobalLayoutListener listener = new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
hsv.scrollTo(100, 0);
}
};
ll.getViewTreeObserver().addOnGlobalLayoutListener(listener);
代码示例来源:origin: stackoverflow.com
final HorizontalScrollView MenuScroll = (HorizontalScrollView) findViewById(R.id.MenuScroll);
MenuScroll.post(new Runnable() {
@Override
public void run() {
final Button button3 = (Button) findViewById(R.id.button3);
int scrollTo = 0;
final int count = ((LinearLayout) MenuScroll.getChildAt(0))
.getChildCount();
for (int i = 0; i < count; i++) {
final View child = ((LinearLayout) MenuScroll.getChildAt(0))
.getChildAt(i);
if (child != button3) {
scrollTo += child.getWidth();
} else {
break;
}
}
MenuScroll.scrollTo(scrollTo, 0);
}
});
代码示例来源:origin: OCNYang/QBox
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
if (mAdapter != null) {
mNavigatorHelper.onPageScrolled(position, positionOffset, positionOffsetPixels);
if (mIndicator != null) {
mIndicator.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
// 手指跟随滚动
if (mScrollView != null && mPositionDataList.size() > 0 && position >= 0 && position < mPositionDataList.size()) {
if (mFollowTouch) {
int currentPosition = Math.min(mPositionDataList.size() - 1, position);
int nextPosition = Math.min(mPositionDataList.size() - 1, position + 1);
PositionData current = mPositionDataList.get(currentPosition);
PositionData next = mPositionDataList.get(nextPosition);
float scrollTo = current.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
float nextScrollTo = next.horizontalCenter() - mScrollView.getWidth() * mScrollPivotX;
mScrollView.scrollTo((int) (scrollTo + (nextScrollTo - scrollTo) * positionOffset), 0);
} else if (!mEnablePivotScroll) {
// TODO 实现待选中项完全显示出来
}
}
}
}
代码示例来源:origin: OCNYang/QBox
mScrollView.smoothScrollTo((int) (scrollTo), 0);
} else {
mScrollView.scrollTo((int) (scrollTo), 0);
mScrollView.smoothScrollTo(current.mLeft, 0);
} else {
mScrollView.scrollTo(current.mLeft, 0);
mScrollView.smoothScrollTo(current.mRight - getWidth(), 0);
} else {
mScrollView.scrollTo(current.mRight - getWidth(), 0);
代码示例来源:origin: stackoverflow.com
public void scrollRight(final HorizontalScrollView h){
new CountDownTimer(2000, 20) {
public void onTick(long millisUntilFinished) {
h.scrollTo((int) (2000 - millisUntilFinished), 0);
}
public void onFinish() {
}
}.start(); }
代码示例来源:origin: 296777513/pedometer
public boolean handleMessage(Message msg) {
HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
hsv.scrollTo(postSel * (dp_36 + dp_9), 0);
return false;
}
});
代码示例来源:origin: Tencent/RapidView
public void run(RapidParserObject object, Object view, Var value) {
List<String> list = RapidStringUtils.stringToList(value.getString());
if( list.size() < 2 ){
return;
}
((HorizontalScrollView)view).scrollTo(Integer.parseInt(list.get(0)), Integer.parseInt(list.get(1)));
}
}
代码示例来源:origin: stackoverflow.com
protected void onResume() {
super.onResume();
final HorizontalScrollView svInMenu = (HorizontalScrollView) findViewById(R.id.svInMenu);
ViewTreeObserver vto = svInMenu.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
svInMenu.scrollTo(svInMenu.getRight() / 4, 0);
}
});
}
代码示例来源:origin: infinum/android_dbinspector
@Override
public void onClick(View v) {
currentPage--;
adapter.previousPage();
showContent();
scrollView.scrollTo(0, 0);
horizontalScrollView.scrollTo(0, 0);
}
};
代码示例来源:origin: infinum/android_dbinspector
@Override
public void onClick(View v) {
currentPage++;
adapter.nextPage();
showContent();
scrollView.scrollTo(0, 0);
horizontalScrollView.scrollTo(0, 0);
}
};
代码示例来源:origin: samlss/TimoMenu
public void showNow(){
if (!moveToTheFirstOneWhenShow
|| getScrollViews() == null){
return;
}
for (HorizontalScrollView subScrollView : getScrollViews()){
subScrollView.scrollTo(0, 0);
}
}
代码示例来源:origin: stackoverflow.com
public void scroll(int scroll_to)
{
final int x = scroll_to;
final HorizontalScrollView scrl = (HorizontalScrollView)findViewById(R.id.horizontalScrollView1);
scrl.post(new Runnable()
{
public void run()
{
scrl.scrollTo(0, x);
}
});
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
scroll.scrollTo(masterWallpaperList.getWidth(), 0);
scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
代码示例来源:origin: stackoverflow.com
HorizontalScrollView scroller;
int scrollerWidth = scroller.getMeasuredWidth();
int scrollX = scroller.getScrollX();
int activeViewCount = 0;
activeViewCount = (activeViewCount > 0) ? activeViewCount - 1 : 0;
scroller.smoothScrollTo(activeViewCount * scrollerWidth, 0);
if (scrollX >= scrollerWidth) {
scroller.scrollTo(0, 0);
}
内容来源于网络,如有侵权,请联系作者删除!