SwipeView类似桌面的滑动界面(2)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
}
/**
* {@inheritDoc}
*/
public SwipeView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs,defStyle);
mContext = context;
initSwipeView();
}
private void initSwipeView()
{
Log.i("uk.co.jasonfry.android.tools.ui.SwipeView","Initialising SwipeView");
mLinearLayout = new LinearLayout(mContext);
mLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
super.addView(mLinearLayout, -1, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
setSmoothScrollingEnabled(true);
setHorizontalFadingEdgeEnabled(false);
setHorizontalScrollBarEnabled(false);
Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
SCREEN_WIDTH = (int) (display.getWidth());
mPageWidth = SCREEN_WIDTH;
mCurrentPage = 0;
mSwipeOnTouchListener = new SwipeOnTouchListener();
super.setOnTouchListener(mSwipeOnTouchListener);
}
/**
* {@inheritDoc}
*/
@Override
public boolean onTrackballEvent(MotionEvent event)
{
return true;
}
@Override
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)
{
//this will now pass trackball events down to onTrackballEvent
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>