本文整理匯總了Java中android.widget.Scroller.setFriction方法的典型用法代碼示例。如果您正苦於以下問題:Java Scroller.setFriction方法的具體用法?Java Scroller.setFriction怎麽用?Java Scroller.setFriction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.Scroller
的用法示例。
在下文中一共展示了Scroller.setFriction方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: QMUIPullRefreshLayout
import android.widget.Scroller; //導入方法依賴的package包/類
public QMUIPullRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setWillNotDraw(false);
final ViewConfiguration vc = ViewConfiguration.get(context);
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMiniVelocity = vc.getScaledMinimumFlingVelocity();
mSystemTouchSlop = vc.getScaledTouchSlop();
mTouchSlop = QMUIDisplayHelper.px2dp(context, mSystemTouchSlop); //係統的值是8dp,如何配置?
mScroller = new Scroller(getContext());
mScroller.setFriction(getScrollerFriction());
addRefreshView();
ViewCompat.setChildrenDrawingOrderEnabled(this, true);
mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
TypedArray array = context.obtainStyledAttributes(attrs,
R.styleable.QMUIPullRefreshLayout, defStyleAttr, 0);
try {
mRefreshInitOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_refresh_init_offset, Integer.MIN_VALUE);
mRefreshEndOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_refresh_end_offset, Integer.MIN_VALUE);
mTargetInitOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_target_init_offset, 0);
mTargetRefreshOffset = array.getDimensionPixelSize(
R.styleable.QMUIPullRefreshLayout_qmui_target_refresh_offset,
QMUIDisplayHelper.dp2px(getContext(), 72));
mAutoCalculateRefreshInitOffset = mRefreshInitOffset == Integer.MIN_VALUE ||
array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_init_offset, false);
mAutoCalculateRefreshEndOffset = mRefreshEndOffset == Integer.MIN_VALUE ||
array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_end_offset, false);
mEqualTargetRefreshOffsetToRefreshViewHeight = array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_equal_target_refresh_offset_to_refresh_view_height, false);
} finally {
array.recycle();
}
mRefreshCurrentOffset = mRefreshInitOffset;
mTargetCurrentOffset = mTargetInitOffset;
}
示例2: setFriction
import android.widget.Scroller; //導入方法依賴的package包/類
/** Sets the friction for the provided scroller */
public static void setFriction(Scroller scroller, float friction) {
if (scroller != null) {
scroller.setFriction(friction);
}
}