本文整理汇总了Java中android.support.v4.widget.ScrollerCompat.create方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollerCompat.create方法的具体用法?Java ScrollerCompat.create怎么用?Java ScrollerCompat.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.ScrollerCompat
的用法示例。
在下文中一共展示了ScrollerCompat.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance.
* This will allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例2: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance. This will
* allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例3: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance.
* This will allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例4: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance. This will
* allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context
* Context to initialize config-dependent params from
* @param forParent
* Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例5: TranslationViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance.
* This will allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private TranslationViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例6: init
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
public void init() {
mGestureListener = new SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {
isFling = false;
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2,
float velocityX, float velocityY) {
if (velocityX > mViewConfiguration.getScaledMinimumFlingVelocity() || velocityY > mViewConfiguration.getScaledMinimumFlingVelocity())
isFling = true;
return isFling;
}
};
mGestureDetector = new GestureDetectorCompat(getContext(),
mGestureListener);
mCloseScroller = ScrollerCompat.create(getContext());
mOpenScroller = ScrollerCompat.create(getContext());
}
示例7: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance. This will
* allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context
* Context to initialize config-dependent params from
* @param forParent
* Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例8: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance. This will
* allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例9: init
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/** 初始化一些常量 */
private void init() {
//把一个值从dip转换成px,根据当前的深度
mIndicatorHeight = UIUtils.dip2px(mIndicatorHeight);
mDividerPadding = UIUtils.dip2px(mDividerPadding);
mTabPadding = UIUtils.dip2px(mTabPadding);
mDividerWidth = UIUtils.dip2px(mDividerWidth);
mTabTextSize = UIUtils.dip2px(mTabTextSize);
//创建一个scroller
mScroller = ScrollerCompat.create(mActivity);
//获取一个系统关于View的常量配置类
final ViewConfiguration configuration = ViewConfiguration.get(mActivity);
//获取滑动的最小距离
mTouchSlop = configuration.getScaledTouchSlop();
//获取fling的最小速度
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
//获取fling的最大速度
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(mActivity);
mRightEdge = new EdgeEffectCompat(mActivity);
}
示例10: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance. This will
* allow VDH to use internal compatibility implementations for different
* platform versions.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
*/
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, sInterpolator);
}
示例11: MenuLayout
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
public MenuLayout(View contentView, MenuView menuView) {
super(contentView.getContext());
this.mContentView = contentView;
this.mMenuView = menuView;
this.mMenuView.setMenuLayout(this);
setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
// mGestureDetector = new GestureDetectorCompat(getContext(), mGestureListener);
LayoutParams contentParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
mContentView.setLayoutParams(contentParams);
if (mContentView.getId() < 1) {
mContentView.setId(CONTENT_VIEW_ID);
}
mMenuView.setId(MENU_VIEW_ID);
mMenuView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(mContentView);
addView(mMenuView);
mShowScroller = ScrollerCompat.create(getContext());
mHideScroller = ScrollerCompat.create(getContext());
}
示例12: ViewDragHelper
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
/**
* Apps should use ViewDragHelper.create() to get a new instance.
* This will allow VDH to use internal compatibility implementations for different
* platform versions.
* If the interpolator is null, the default interpolator will be used.
*
* @param context Context to initialize config-dependent params from
* @param forParent Parent view to monitor
* @param interpolator interpolator for scroller
*/
private ViewDragHelper(Context context, ViewGroup forParent, Interpolator interpolator, Callback cb) {
if (forParent == null) {
throw new IllegalArgumentException("Parent view may not be null");
}
if (cb == null) {
throw new IllegalArgumentException("Callback may not be null");
}
mParentView = forParent;
mCallback = cb;
final ViewConfiguration vc = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
mTouchSlop = vc.getScaledTouchSlop();
mMaxVelocity = vc.getScaledMaximumFlingVelocity();
mMinVelocity = vc.getScaledMinimumFlingVelocity();
mScroller = ScrollerCompat.create(context, interpolator != null ? interpolator : sInterpolator);
}
示例13: init
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.InsertAbleGridView, defStyleAttr, R.style.InsertAbleGridViewDefaultStyle);
mRowCount = a.getInt(R.styleable.InsertAbleGridView_RowCount, 2);
mColumnCount = a.getInt(R.styleable.InsertAbleGridView_ColumnCount, 2);
mRowGap = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_RowGap, 10);
mColumnGap = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_ColumnGap, 10);
mOutLinePadding = a.getDimensionPixelSize(R.styleable.InsertAbleGridView_OutlinePadding, 10);
mInnerPadding = a.getDimensionPixelOffset(R.styleable.InsertAbleGridView_InnerPadding, 10);
mBagDrawable = new BagDrawable(mOutLinePadding);
mBagDrawable.setOutlineStyle(a.getColor(R.styleable.InsertAbleGridView_OutlineColor, 0), a.getDimensionPixelSize(R.styleable.InsertAbleGridView_OutlineWidth, 3));
setBackgroundDrawable(mBagDrawable);
a.recycle();
mScroller = ScrollerCompat.create(context);
}
示例14: PieChartTouchHandler
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
public PieChartTouchHandler(Context context, PieChartView chart) {
super(context, chart);
pieChart = (PieChartView) chart;
scroller = ScrollerCompat.create(context);
gestureDetector = new GestureDetector(context, new ChartGestureListener());
scaleGestureDetector = new ScaleGestureDetector(context, new ChartScaleGestureListener());
isZoomEnabled = false;// Zoom is not supported by PieChart.
}
示例15: init
import android.support.v4.widget.ScrollerCompat; //导入方法依赖的package包/类
private void init(Context context){
mScroller = ScrollerCompat.create(context);
mMiniVelocityFling = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity();
mScaledTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
if(mTextSizeNormal == 0) mTextSizeNormal = sp2px(context, DEFAULT_TEXT_SIZE_NORMAL_SP);
if(mTextSizeSelected == 0) mTextSizeSelected = sp2px(context, DEFAULT_TEXT_SIZE_SELECTED_SP);
if(mTextSizeHint == 0) mTextSizeHint = sp2px(context, DEFAULT_TEXT_SIZE_HINT_SP);
if(mMarginStartOfHint == 0) mMarginStartOfHint = dp2px(context, DEFAULT_MARGIN_START_OF_HINT_DP);
if(mMarginEndOfHint == 0) mMarginEndOfHint = dp2px(context, DEFAULT_MARGIN_END_OF_HINT_DP);
mPaintDivider.setColor(mDividerColor);
mPaintDivider.setAntiAlias(true);
mPaintDivider.setStyle(Paint.Style.STROKE);
mPaintDivider.setStrokeWidth(mDividerHeight);
mPaintText.setColor(mTextColorNormal);
mPaintText.setAntiAlias(true);
mPaintText.setTextAlign(Align.CENTER);
mPaintHint.setColor(mTextColorHint);
mPaintHint.setAntiAlias(true);
mPaintHint.setTextAlign(Align.CENTER);
mPaintHint.setTextSize(mTextSizeHint);
if(mShowCount % 2 == 0){
mShowCount++;
}
if(mMinShowIndex == -1 || mMaxShowIndex == -1){
updateValueForInit();
}
initHandler();
}