本文整理了Java中android.widget.ScrollView.fling()
方法的一些代码示例,展示了ScrollView.fling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.fling()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:fling
暂无
代码示例来源:origin: scwang90/SmartRefreshLayout
public static void fling(View scrollableView, int velocity) {
if (scrollableView instanceof ScrollView) {
((ScrollView) scrollableView).fling(velocity);
} else if (scrollableView instanceof AbsListView) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
((AbsListView) scrollableView).fling(velocity);
}
} else if (scrollableView instanceof WebView) {
((WebView) scrollableView).flingScroll(0, velocity);
} else if (scrollableView instanceof NestedScrollView) {
((NestedScrollView) scrollableView).fling(velocity);
} else if (scrollableView instanceof RecyclerView) {
((RecyclerView) scrollableView).fling(0, velocity);
}
}
}
代码示例来源:origin: weexteam/weex-hackernews
@Override
public void fling(int velocityY) {
super.fling(velocityY);
if (mScrollerTask != null) {
mScrollerTask.removeMessages(0);
}
startScrollerTask();
}
代码示例来源:origin: leftcoding/GankLy
@Override
public void fling(int velocityY) {
super.fling(velocityY / 3);
}
代码示例来源:origin: cjiahuan/ReboundScrollView
@Override
public void fling(int velocityY) {
super.fling(velocityY / 2);
}
代码示例来源:origin: mnnyang/ClassSchedule
@Override
public void fling(int velocityY) {
super.fling(velocityY / 3);
}
代码示例来源:origin: Tencent/RapidView
public void run(RapidParserObject object, Object view, Var value) {
((ScrollView)view).fling(value.getInt());
}
}
代码示例来源:origin: stackoverflow.com
public class PreferenceActivity extends Activity {
//Sorry for stupid variable names, couldn't be bothered to be smart
private ScrollView svOptions;
private Runnable _run_sb_on;
private final Handler _handle_sb_on = new Handler();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.preference);
svOptions = (ScrollView) findViewById(R.id.svOptions);
_run_sb_on = new Runnable() { //i hate you google for making me write crap code !
public void run() {
svOptions.fling(0); //don't move it, just keep it alive
_handle_sb_on.postDelayed(this, 300); //300 is the timeout of the fader
}
};
_handle_sb_on.post(_run_sb_on);
}
// etc
}
代码示例来源:origin: w446108264/ScrollableLayout
@SuppressLint("NewApi")
public void smoothScrollBy(int velocityY, int distance, int duration) {
View scrollableView = getScrollableView();
if (scrollableView instanceof AbsListView) {
AbsListView absListView = (AbsListView) scrollableView;
if (sysVersion >= 21) {
absListView.fling(velocityY);
} else {
absListView.smoothScrollBy(distance, duration);
}
} else if (scrollableView instanceof ScrollView) {
((ScrollView) scrollableView).fling(velocityY);
} else if (scrollableView instanceof RecyclerView) {
((RecyclerView) scrollableView).fling(0, velocityY);
} else if (scrollableView instanceof WebView) {
((WebView)scrollableView).flingScroll(0,velocityY);
}
}
}
代码示例来源:origin: jeasonlzy/HeaderViewPager
/**
* 将特定的view按照初始条件滚动
*
* @param velocityY 初始滚动速度
* @param distance 需要滚动的距离
* @param duration 允许滚动的时间
*/
@SuppressLint("NewApi")
public void smoothScrollBy(int velocityY, int distance, int duration) {
View scrollableView = getScrollableView();
if (scrollableView instanceof AbsListView) {
AbsListView absListView = (AbsListView) scrollableView;
if (sysVersion >= 21) {
absListView.fling(velocityY);
} else {
absListView.smoothScrollBy(distance, duration);
}
} else if (scrollableView instanceof ScrollView) {
((ScrollView) scrollableView).fling(velocityY);
} else if (scrollableView instanceof RecyclerView) {
((RecyclerView) scrollableView).fling(0, velocityY);
} else if (scrollableView instanceof WebView) {
((WebView) scrollableView).flingScroll(0, velocityY);
}
}
}
代码示例来源:origin: colinNaive/RecyclerViewScrollView
/**
* 将特定的view按照初始条件滚动
*
* @param velocityY 初始滚动速度
* @param distance 需要滚动的距离
* @param duration 允许滚动的时间
*/
@SuppressLint("NewApi")
public void smoothScrollBy(int velocityY, int distance, int duration) {
View scrollableView = getScrollableView();
if (scrollableView instanceof AbsListView) {
AbsListView absListView = (AbsListView) scrollableView;
if (sysVersion >= 21) {
absListView.fling(velocityY);
} else {
absListView.smoothScrollBy(distance, duration);
}
} else if (scrollableView instanceof ScrollView) {
((ScrollView) scrollableView).fling(velocityY);
} else if (scrollableView instanceof RecyclerView) {
((RecyclerView) scrollableView).fling(0, velocityY);
} else if (scrollableView instanceof WebView) {
((WebView) scrollableView).flingScroll(0, velocityY);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!