本文整理了Java中android.widget.ScrollView.postDelayed()
方法的一些代码示例,展示了ScrollView.postDelayed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.postDelayed()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:postDelayed
暂无
代码示例来源:origin: topjohnwu/libsu
@Override
public void onAddElement(String s) {
console.setText(TextUtils.join("\n", this));
sv.postDelayed(() -> sv.fullScroll(ScrollView.FOCUS_DOWN), 10);
}
代码示例来源:origin: codeka/wwmmo
private void scrollToBottom() {
scrollView.postDelayed(() -> scrollView.fullScroll(ScrollView.FOCUS_DOWN), 1);
}
代码示例来源:origin: Wilm0r/giggity
public void saveScroll() {
final ScrollView sv = (ScrollView) root.findViewById(R.id.scrollDescription);
final View inner = sv.getChildAt(0);
if (sv.getScrollY() == 0 || inner.getHeight() <= sv.getHeight()) {
return;
}
final double ratio = Math.max(0, Math.min(1, (double) sv.getScrollY() / (inner.getHeight() - sv.getHeight())));
/* Grmbl. There's no great way to do this. I tried throwing this into an onLayout listener
but that's not the right time either. So just set a timer to the moment the animation
finishes (doing it earlier won't work).. */
sv.postDelayed(new Runnable() {
@Override
public void run() {
sv.scrollTo(0, (int) (ratio * (inner.getHeight() - sv.getHeight())));
}
}, 500);
}
代码示例来源:origin: topjohnwu/libsu
@Override
public void onAddElement(String s) {
console.append(s);
console.append("\n");
sv.postDelayed(() -> sv.fullScroll(ScrollView.FOCUS_DOWN), 10);
}
代码示例来源:origin: stackoverflow.com
private ScrollView _scrollView;
private Runnable _smoothScrollRunnable = new Runnable() {
@Override
public void run() {
_scrollView.smoothScrollBy(2, 2);
if (_scrollView.canScrollVertically(1)) {
_scrollView.postDelayed(_smoothScrollRunnable, 75);
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
_scrollView = (ScrollView) findViewById(R.id.scrollview);
}
@Override
protected void onResume() {
super.onResume();
_scrollView.post(_smoothScrollRunnable);
}
内容来源于网络,如有侵权,请联系作者删除!