- 浏览: 5816046 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (890)
- WindowsPhone (0)
- android (88)
- android快速迭代 (17)
- android基础 (34)
- android进阶 (172)
- android高级 (0)
- android拾遗 (85)
- android动画&效果 (68)
- Material Design (13)
- LUA (5)
- j2me (32)
- jQuery (39)
- spring (26)
- hibernate (20)
- struts (26)
- tomcat (9)
- javascript+css+html (62)
- jsp+servlet+javabean (14)
- java (37)
- velocity+FCKeditor (13)
- linux+批处理 (9)
- mysql (19)
- MyEclipse (9)
- ajax (7)
- wap (8)
- j2ee+apache (24)
- 其他 (13)
- phonegap (35)
最新评论
-
Memories_NC:
本地lua脚本终于执行成功了,虽然不是通过redis
java中调用lua脚本语言1 -
ZHOU452840622:
大神://处理返回的接收状态 这个好像没有监听到 遇 ...
android 发送短信的两种方式 -
PXY:
拦截部分地址,怎么写的for(int i=0;i<lis ...
判断是否登录的拦截器SessionFilter -
maotou1988:
Android控件之带清空按钮(功能)的AutoComplet ...
自定义AutoCompleteTextView -
yangmaolinpl:
希望有表例子更好。。。,不过也看明白了。
浅谈onInterceptTouchEvent、onTouchEvent与onTouch
使用了android 2.0以上的ExifInterface来生成缩略图。可用来设计游戏的选关界面。
import uk.co.jasonfry.android.tools.ui.PageControl.OnPageControlClickListener; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.util.Log; import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; public class SwipeView extends HorizontalScrollView { private static int DEFAULT_SWIPE_THRESHOLD = 60; private LinearLayout mLinearLayout; private Context mContext; private int SCREEN_WIDTH; private int mMotionStartX; private int mMotionStartY; private boolean mMostlyScrollingInX = false; private boolean mMostlyScrollingInY = false; private boolean mJustInterceptedAndIgnored = false; protected boolean mCallScrollToPageInOnLayout = false; private int mCurrentPage = 0; private int mPageWidth = 0; private OnPageChangedListener mOnPageChangedListener = null; private SwipeOnTouchListener mSwipeOnTouchListener; private View.OnTouchListener mOnTouchListener; private PageControl mPageControl = null; /** * {@inheritDoc} */ public SwipeView(Context context) { super(context); mContext = context; initSwipeView(); } /** * {@inheritDoc} */ public SwipeView(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; initSwipeView(); } /** * {@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 return false; } @Override public void requestChildFocus(View child, View focused) { //this will now pass trackball events down to onRequestFocusInDescendants requestFocus(); } /** * {@inheritDoc} */ @Override public void addView(View child) { this.addView(child,-1); } /** * {@inheritDoc} */ @Override public void addView (View child, int index) { ViewGroup.LayoutParams params; if(child.getLayoutParams()==null) { params = new LayoutParams(mPageWidth, LayoutParams.FILL_PARENT); } else { params = child.getLayoutParams(); params.width = mPageWidth; } this.addView(child, index, params); } /** * {@inheritDoc} */ @Override public void addView (View child, ViewGroup.LayoutParams params) { params.width = mPageWidth; this.addView (child, -1, params); } /** * {@inheritDoc} */ @Override public void addView (View child, int index, ViewGroup.LayoutParams params) { requestLayout(); invalidate(); mLinearLayout.addView(child, index, params); } /** * {@inheritDoc} */ @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if(mCallScrollToPageInOnLayout) { scrollToPage(mCurrentPage); mCallScrollToPageInOnLayout = false; } } /** * {@inheritDoc} */ @Override public void setOnTouchListener(View.OnTouchListener onTouchListener) { mOnTouchListener = onTouchListener; } /** * Get the View object that contains all the children of this SwipeView. The same as calling getChildAt(0) * A SwipeView behaves slightly differently from a normal ViewGroup, all the children of a SwipeView * sit within a LinearLayout, which then sits within the SwipeView object. * * @return linearLayout The View object that contains all the children of this view */ public LinearLayout getChildContainer() { return mLinearLayout; } /** * Get the swiping threshold distance to make the screens change * * @return swipeThreshold The minimum distance the finger should move to allow the screens to change */ public int getSwipeThreshold() { return DEFAULT_SWIPE_THRESHOLD; } /** * Set the swiping threshold distance to make the screens change * * @param swipeThreshold The minimum distance the finger should move to allow the screens to change */ public void setSwipeThreshold(int swipeThreshold) { DEFAULT_SWIPE_THRESHOLD = swipeThreshold; } /** * Get the current page the SwipeView is on * * @return The current page the SwipeView is on */ public int getCurrentPage() { return mCurrentPage; } /** * Return the number of pages in this SwipeView * * @return Returns the number of pages in this SwipeView */ public int getPageCount() { return mLinearLayout.getChildCount(); } /** * Go directly to the specified page * * @param page The page to scroll to */ public void scrollToPage(int page) { scrollToPage(page,false); } /** * Animate a scroll to the specified page * * @param page The page to animate to */ public void smoothScrollToPage(int page) { scrollToPage(page,true); } private void scrollToPage(int page, boolean smooth) { int oldPage = mCurrentPage; if(page>=getPageCount() && getPageCount()>0) { page--; } else if(page<0) { page=0; } if(smooth) { smoothScrollTo(page*mPageWidth,0); } else { scrollTo(page*mPageWidth,0); } mCurrentPage = page; if(mOnPageChangedListener!=null && oldPage!=page) { mOnPageChangedListener.onPageChanged(oldPage, page); } if(mPageControl!=null && oldPage!=page) { mPageControl.setCurrentPage(page); } mCallScrollToPageInOnLayout=!mCallScrollToPageInOnLayout; } /** * Set the width of each page. This function returns an integer that should be added to the left margin of * the first child and the right margin of the last child. This enables all the children to appear to be * central * * @param pageWidth The width you wish to assign for each page * @return An integer to add to the left margin of the first child and the right margin of the last child */ public int setPageWidth(int pageWidth) { mPageWidth = pageWidth; return (SCREEN_WIDTH - mPageWidth)/2; } /** * Set the width of each page by using the layout parameters of a child. Call this function before you add * the child to the SwipeView to maintain the child's size. This function returns an integer that should * be added to the left margin of the first child and the right margin of the last child. This enables all * the children to appear to be central * * @param childLayoutParams A child view that you have added / will add to the SwipeView * @return An integer to add to the left margin of the first child and the right margin of the last child */ public int calculatePageSize(MarginLayoutParams childLayoutParams) { return setPageWidth(childLayoutParams.leftMargin + childLayoutParams.width + childLayoutParams.rightMargin); } /** * Return the current width of each page * * @return Returns the width of each page */ public int getPageWidth() { return mPageWidth; } /** * Assign a PageControl object to this SwipeView. Call after adding all the children * * @param pageControl The PageControl object to assign */ public void setPageControl(PageControl pageControl) { mPageControl = pageControl; pageControl.setPageCount(getPageCount()); pageControl.setCurrentPage(mCurrentPage); pageControl.setOnPageControlClickListener(new OnPageControlClickListener() { public void goForwards() { smoothScrollToPage(mCurrentPage+1); } public void goBackwards() { smoothScrollToPage(mCurrentPage-1); } }); } /** * Return the current PageControl object * * @return Returns the current PageControl object */ public PageControl getPageControl() { return mPageControl; } /** * Implement this listener to listen for page change events * * @author Jason Fry - jasonfry.co.uk * */ public interface OnPageChangedListener { /** * Event for when a page changes * * @param oldPage The page the view was on previously * @param newPage The page the view has moved to */ public abstract void onPageChanged(int oldPage, int newPage); } /** * Set the current OnPageChangedListsner * * @param onPageChangedListener The OnPageChangedListener object */ public void setOnPageChangedListener(OnPageChangedListener onPageChangedListener) { mOnPageChangedListener = onPageChangedListener; } /** * Get the current OnPageChangeListsner * * @return The current OnPageChangedListener */ public OnPageChangedListener getOnPageChangedListener() { return mOnPageChangedListener; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { boolean result = super.onInterceptTouchEvent(ev); if(ev.getAction() == MotionEvent.ACTION_DOWN) { mMotionStartX = (int) ev.getX(); mMotionStartY = (int) ev.getY(); if(!mJustInterceptedAndIgnored) { mMostlyScrollingInX = false; mMostlyScrollingInY = false; } } else if(ev.getAction()==MotionEvent.ACTION_MOVE) { detectMostlyScrollingDirection(ev); } if(mMostlyScrollingInY) { return false; } if(mMostlyScrollingInX) { mJustInterceptedAndIgnored = true; return true; } return result; } private void detectMostlyScrollingDirection(MotionEvent ev) { if(!mMostlyScrollingInX && !mMostlyScrollingInY) //if we dont know which direction we're going yet { float xDistance = Math.abs(mMotionStartX - ev.getX()); float yDistance = Math.abs(mMotionStartY - ev.getY()); if(yDistance>xDistance+5) { mMostlyScrollingInY = true; } else if(xDistance>yDistance+5) { mMostlyScrollingInX = true; } } } private class SwipeOnTouchListener implements View.OnTouchListener { private boolean mSendingDummyMotionEvent = false; private int mDistanceX; private int mPreviousDirection; private boolean mFirstMotionEvent = true; public boolean onTouch(View v, MotionEvent event) { if(mOnTouchListener!=null && !mJustInterceptedAndIgnored || mOnTouchListener!=null && mSendingDummyMotionEvent) //send on touch event to onTouchListener set by an application implementing a SwipeView and setting their own onTouchListener { if(mOnTouchListener.onTouch(v, event)) { if(event.getAction() == MotionEvent.ACTION_UP) //this comes back if a very quick movement event has happened over a view with an onClick { //need to call the actionUp directly so the view is not left between pages. actionUp(event); } return true; } } if(mSendingDummyMotionEvent)//if sending the fake action down event (to do with vertical scrolling within this horizontalscrollview) then just ignore it { mSendingDummyMotionEvent = false; return false; } switch(event.getAction()) { case MotionEvent.ACTION_DOWN : return actionDown(event); case MotionEvent.ACTION_MOVE : return actionMove(event); case MotionEvent.ACTION_UP : return actionUp(event); } return false; } private boolean actionDown(MotionEvent event) { mMotionStartX = (int) event.getX(); mMotionStartY = (int) event.getY(); mFirstMotionEvent = false; return false; } private boolean actionMove(MotionEvent event) { int newDistance = mMotionStartX - (int) event.getX(); int newDirection; if(newDistance<0) //backwards { newDirection = (mDistanceX+4 <= newDistance) ? 1 : -1; //the distance +4 is to allow for jitter } else //forwards { newDirection = (mDistanceX-4 <= newDistance) ? 1 : -1; //the distance -4 is to allow for jitter } if(newDirection != mPreviousDirection && !mFirstMotionEvent)//changed direction, so reset start point { mMotionStartX = (int) event.getX(); mDistanceX = mMotionStartX - (int) event.getX(); } else { mDistanceX = newDistance; } mPreviousDirection = newDirection; //backwards -1, forwards is 1, if(mJustInterceptedAndIgnored)//if the intercept picked it up first, we need to give the horizontalscrollview ontouch an action down to enable it to scroll and follow your finger { mSendingDummyMotionEvent = true; dispatchTouchEvent(MotionEvent.obtain(event.getDownTime(), event.getEventTime(), MotionEvent.ACTION_DOWN, mMotionStartX, mMotionStartY, event.getPressure(), event.getSize(), event.getMetaState(), event.getXPrecision(), event.getYPrecision(), event.getDeviceId(), event.getEdgeFlags())); mJustInterceptedAndIgnored = false; return true; } return false; } private boolean actionUp(MotionEvent event) { float fingerUpPosition = getScrollX(); float numberOfPages = mLinearLayout.getMeasuredWidth() / mPageWidth; float fingerUpPage = fingerUpPosition/mPageWidth; float edgePosition = 0; if(mPreviousDirection == 1) //forwards { if(mDistanceX > DEFAULT_SWIPE_THRESHOLD)//if over then go forwards { if(mCurrentPage<(numberOfPages-1))//if not at the end of the pages, you don't want to try and advance into nothing! { edgePosition = (int)(fingerUpPage+1)*mPageWidth; } else { edgePosition = (int)(mCurrentPage)*mPageWidth; } } else //return to start position { if(Math.round(fingerUpPage)==numberOfPages-1)//if at the end { //need to correct for when user starts to scroll into //nothing then pulls it back a bit, this becomes a //kind of forwards scroll instead edgePosition = (int)(fingerUpPage+1)*mPageWidth; } else //carry on as normal { edgePosition = mCurrentPage*mPageWidth; } } } else //backwards { if(mDistanceX < -DEFAULT_SWIPE_THRESHOLD)//go backwards { edgePosition = (int)(fingerUpPage)*mPageWidth; } else //return to start position { if(Math.round(fingerUpPage)==0)//if at beginning, correct { //need to correct for when user starts to scroll into //nothing then pulls it back a bit, this becomes a //kind of backwards scroll instead edgePosition = (int)(fingerUpPage)*mPageWidth; } else //carry on as normal { edgePosition = mCurrentPage*mPageWidth; } } } smoothScrollToPage((int)edgePosition/mPageWidth); mFirstMotionEvent = true; mDistanceX = 0; mMostlyScrollingInX = false; mMostlyScrollingInY = false; return true; } } }
import java.util.ArrayList; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.graphics.drawable.shapes.Shape; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; public class PageControl extends LinearLayout { private int mIndicatorSize = 7; private Drawable activeDrawable; private Drawable inactiveDrawable; private ArrayList<ImageView> indicators; private int mPageCount = 0; private int mCurrentPage = 0; private Context mContext; private OnPageControlClickListener mOnPageControlClickListener = null; public PageControl(Context context) { super(context); mContext = context; initPageControl(); } public PageControl(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; //will now wait until onFinishInflate to call initPageControl() } @Override protected void onFinishInflate() { initPageControl(); } private void initPageControl() { Log.i("uk.co.jasonfry.android.tools.ui.PageControl","Initialising PageControl"); indicators = new ArrayList<ImageView>(); activeDrawable = new ShapeDrawable(); inactiveDrawable = new ShapeDrawable(); activeDrawable.setBounds(0, 0, mIndicatorSize, mIndicatorSize); inactiveDrawable.setBounds(0, 0, mIndicatorSize, mIndicatorSize); Shape s1 = new OvalShape(); s1.resize(mIndicatorSize, mIndicatorSize); Shape s2 = new OvalShape(); s2.resize(mIndicatorSize, mIndicatorSize); int i[] = new int[2]; i[0] = android.R.attr.textColorSecondary; i[1] = android.R.attr.textColorSecondaryInverse; TypedArray a = mContext.getTheme().obtainStyledAttributes(i); ((ShapeDrawable) activeDrawable).getPaint().setColor(a.getColor(0, Color.DKGRAY)); ((ShapeDrawable) inactiveDrawable).getPaint().setColor(a.getColor(1, Color.LTGRAY)); ((ShapeDrawable) activeDrawable).setShape(s1); ((ShapeDrawable) inactiveDrawable).setShape(s2); mIndicatorSize = (int) (mIndicatorSize * getResources().getDisplayMetrics().density); setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if(mOnPageControlClickListener != null) { switch(event.getAction()) { case MotionEvent.ACTION_UP : if(PageControl.this.getOrientation() == LinearLayout.HORIZONTAL) { if(event.getX()<(PageControl.this.getWidth()/2)) //if on left of view { if(mCurrentPage>0) { mOnPageControlClickListener.goBackwards(); } } else //if on right of view { if(mCurrentPage<(mPageCount-1)) { mOnPageControlClickListener.goForwards(); } } } else { if(event.getY()<(PageControl.this.getHeight()/2)) //if on top half of view { if(mCurrentPage>0) { mOnPageControlClickListener.goBackwards(); } } else //if on bottom half of view { if(mCurrentPage<(mPageCount-1)) { mOnPageControlClickListener.goForwards(); } } } return false; } } return true; } }); } /** * Set the drawable object for an active page indicator * * @param d The drawable object for an active page indicator */ public void setActiveDrawable(Drawable d) { activeDrawable = d; indicators.get(mCurrentPage).setBackgroundDrawable(activeDrawable); } /** * Return the current drawable object for an active page indicator * * @return Returns the current drawable object for an active page indicator */ public Drawable getActiveDrawable() { return activeDrawable; } /** * Set the drawable object for an inactive page indicator * * @param d The drawable object for an inactive page indicator */ public void setInactiveDrawable(Drawable d) { inactiveDrawable = d; for(int i=0; i<mPageCount; i++) { indicators.get(i).setBackgroundDrawable(inactiveDrawable); } indicators.get(mCurrentPage).setBackgroundDrawable(activeDrawable); } /** * Return the current drawable object for an inactive page indicator * * @return Returns the current drawable object for an inactive page indicator */ public Drawable getInactiveDrawable() { return inactiveDrawable; } /** * Set the number of pages this PageControl should have * * @param pageCount The number of pages this PageControl should have */ public void setPageCount(int pageCount) { mPageCount = pageCount; for(int i=0;i<pageCount;i++) { final ImageView imageView = new ImageView(mContext); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mIndicatorSize, mIndicatorSize); params.setMargins(mIndicatorSize/2, mIndicatorSize, mIndicatorSize/2, mIndicatorSize); imageView.setLayoutParams(params); imageView.setBackgroundDrawable(inactiveDrawable); indicators.add(imageView); addView(imageView); } } /** * Return the number of pages this PageControl has * * @return Returns the number of pages this PageControl has */ public int getPageCount() { return mPageCount; } /** * Set the current page the PageControl should be on * * @param currentPage The current page the PageControl should be on */ public void setCurrentPage(int currentPage) { if(currentPage<mPageCount) { indicators.get(mCurrentPage).setBackgroundDrawable(inactiveDrawable);//reset old indicator indicators.get(currentPage).setBackgroundDrawable(activeDrawable);//set up new indicator mCurrentPage = currentPage; } } /** * Return the current page the PageControl is on * * @return Returns the current page the PageControl is on */ public int getCurrentPage() { return mCurrentPage; } /** * Set the size of the page indicator drawables * * @param indicatorSize The size of the page indicator drawables */ public void setIndicatorSize(int indicatorSize) { mIndicatorSize=indicatorSize; for(int i=0;i<mPageCount;i++) { indicators.get(i).setLayoutParams(new LayoutParams(mIndicatorSize, mIndicatorSize)); } } /** * Return the size of the page indicator drawables * * @return Returns the size of the page indicator drawables */ public int getIndicatorSize() { return mIndicatorSize; } /** * * @author Jason Fry - jasonfry.co.uk * * Interface definition for a callback to be invoked when a PageControl is clicked. * */ public interface OnPageControlClickListener { /** * Called when the PageControl should go forwards * */ public abstract void goForwards(); /** * Called when the PageControl should go backwards * */ public abstract void goBackwards(); } /** * Set the OnPageControlClickListener object for this PageControl * * @param onPageControlClickListener The OnPageControlClickListener you wish to set */ public void setOnPageControlClickListener(OnPageControlClickListener onPageControlClickListener) { mOnPageControlClickListener = onPageControlClickListener; } /** * Return the OnPageControlClickListener that has been set on this PageControl * * @return Returns the OnPageControlClickListener that has been set on this PageControl */ public OnPageControlClickListener getOnPageControlClickListener() { return mOnPageControlClickListener; } }
评论
3 楼
kedee
2012-02-04
资源文件布局文件啥的,都是空的...
2 楼
kedee
2012-02-04
这个确实跑不起来。。。。
1 楼
zkh43javaeye
2011-11-02
兄弟 有没有一个能直接跑起来的例子没?????急需要啊!!!!!谢谢啊!!!
发表评论
-
NestedScrollView滚动到顶部固定子View悬停挂靠粘在顶端
2018-10-31 20:45 6985网上有一个StickyScrollView,称之为粘性Scro ... -
自定义Behavior实现AppBarLayout越界弹性效果
2017-03-31 09:33 10361一、继承AppBarLayout.Beha ... -
Android - 一种相似图片搜索算法的实现
2017-03-31 09:33 2621算法 缩小尺寸。 将图片缩小到8x8的尺寸,总共64个 ... -
使用SpringAnimation实现带下拉弹簧动画的 ScrollView
2017-03-30 11:30 2845在刚推出的 Support Library 25.3.0 里面 ... -
Android为应用添加角标(Badge)
2017-03-30 11:21 61731.需求简介 角标是什么意思呢? 看下图即可明了: 可 ... -
Android端与笔记本利用局域网进行FTP通信
2017-03-23 10:17 974先看图 打开前: 打开后: Activity类 ... -
PorterDuffColorFilter 在项目中的基本使用
2017-03-03 10:58 1351有时候标题栏会浮在内容之上,而内容会有颜色的变化,这时候就要求 ... -
ColorAnimationView 实现了滑动Viewpager 时背景色动态变化的过渡效果
2017-02-24 09:41 2217用法在注释中: import android.anima ... -
迷你轻量级全方向完美滑动处理侧滑控件SlideLayout
2017-01-16 16:53 2594纯手工超级迷你轻量级全方向完美滑动处理侧滑控件(比官方 sup ... -
Effect
2017-01-05 09:57 0https://github.com/JetradarMobi ... -
动态主题库Colorful,容易地改变App的配色方案
2016-12-27 14:49 2562Colorful是一个动态主题库,允许您很容易地改变App的配 ... -
对视图的对角线切割DiagonalView
2016-12-27 14:23 1116提供对视图的对角线切割,具有很好的用户定制 基本用法 ... -
仿淘宝京东拖拽商品详情页上下滚动黏滞效果
2016-12-26 16:53 3489比较常用的效果,有现成的,如此甚好!:) import ... -
让任意view具有滑动效果的SlideUp
2016-12-26 09:26 1705基本的类,只有一个: import android.a ... -
AdvancedWebView
2016-12-21 09:44 16https://github.com/delight-im/A ... -
可设置圆角背景边框的按钮, 通过调节色彩明度自动计算按下(pressed)状态颜色
2016-11-02 22:13 1917可设置圆角背景边框的的按钮, 通过调节色彩明度自动计算按下(p ... -
网络请求库相关
2016-10-09 09:35 62https://github.com/amitshekhari ... -
ASimpleCache一个简单的缓存框架
2015-10-26 22:53 2175ASimpleCache 是一个为android制定的 轻量级 ... -
使用ViewDragHelper实现的DragLayout开门效果
2015-10-23 10:55 3412先看一下图,有个直观的了解,向下拖动handle就“开门了”: ... -
保证图片长宽比的同时拉伸图片ImageView
2015-10-16 15:40 3730按比例放大图片,不拉伸失真 import android. ...
相关推荐
在这个“Android SwipeView类似桌面的滑动界面.zip”压缩包中,包含了一个名为`uk.co.jasonfry.android.tools`的库,这个库可能提供了实现滑动界面所需的工具和功能。 `ExifInterface`是Android SDK中的一个类,...
2. **视图管理**:`SwipeView`需要管理多个子视图,这些子视图通常代表滑动界面的不同页面。你需要维护一个视图列表,并根据滑动事件来更新当前显示的视图。 3. **滑动边界**:确保滑动操作在有效的边界内,防止...
Android SwipeView类似桌面的滑动界面.zip项目安卓应用源码下载Android SwipeView类似桌面的滑动界面.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
"小程序源码 辅助类库 SwipeView类似桌面的滑动界面" 指的是一款用于小程序开发的辅助库,其核心功能是实现SwipeView,这是一个模仿桌面样式的滑动界面组件。在移动应用或小程序中,这种组件能够提供用户友好的交互...
在Android开发中,SwipeView是一种实现桌面式滑动界面的组件,它允许用户左右滑动来切换不同的页面,类似于手机桌面上的应用抽屉效果。这个压缩包“Android SwipeView类似桌面的滑动界面.rar”可能包含了一个实现...
在Android开发中,SwipeView是一种实现桌面式滑动界面的组件,它允许用户通过左右滑动来切换不同的页面,类似于手机或电脑桌面的多任务视图。这种效果常见于许多应用,如音乐播放器、新闻阅读器等,为用户提供流畅且...
在Android开发中,SwipeView是一种实现桌面式滑动界面的组件,它允许用户通过左右滑动来切换不同的页面,类似于手机桌面或者应用抽屉的效果。这个"Android源码——SwipeView类似桌面的滑动界面_new_16.7z"压缩包包含...
在Android开发中,SwipeView是一种实现桌面式滑动界面的组件,它允许用户通过左右滑动来切换不同的页面,类似于手机桌面上应用抽屉的滑动效果。这个压缩包文件"Android源码——SwipeView类似桌面的滑动界面_new_16....
在安卓开发中,SwipeView是一种实现类似桌面滑动效果的组件,它允许用户通过左右滑动来切换不同的页面,这种效果在很多应用中都能见到,比如Google Play商店、新闻阅读应用等。本压缩包提供了实现这一功能的源码,...
这个压缩包文件“Android SwipeView类似桌面的滑动界面”很可能是为了帮助学生理解并实现这种功能而准备的源码示例。下面我们将深入探讨SwipeView的核心原理、实现方式以及它在Android开发中的应用。 SwipeView的...
这个源码资源包"Android SwipeView类似桌面的滑动界面.zip"包含了实现这一功能的具体代码,可以帮助开发者理解和实现这种交互模式。 SwipeView的核心原理是利用触摸事件(MotionEvent)进行手势识别,通过监听用户...
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,...