
我在一个需要stackvIEw的应用程序中.但是我必须实现水平滑动以在stackvIEw项和UI外观之间切换为正常的.请帮我搞定.
我已经检查了这个link.
但在它中UI只是一个封面流程.我想让UI看起来像stackvIEw一样.
最佳答案我创建了一个自定义堆栈视图 public class custom_stackvIEw extends StackVIEw{ float x1,x2,y1,y2,dx,dy; public custom_stackvIEw(Context context,AttributeSet attrs) { super(context,attrs); // Todo auto-generated constructor stub } public custom_stackvIEw(Context context) { super(context); // Todo auto-generated constructor stub } @OverrIDe public boolean ontouchEvent(MotionEvent event) { // Todo auto-generated method stub super.ontouchEvent(event); switch(event.getAction()) { case(MotionEvent.ACTION_DOWN): x1 = event.getX(); y1 = event.getY(); break; case(MotionEvent.ACTION_MOVE): case(MotionEvent.ACTION_UP) :{ x2 = event.getX(); y2 = event.getY(); dx = x2 - x1; dy = y2 - y1; // Use dx and dy to determine the direction if (Math.abs(dx) > Math.abs(dy)) { if (dx > 0) {// direction = "right"; showNext(); } else { showPrevIoUs(); } } } // Log.v("hiiiiiiiiiii",direction+re); } return true; } @OverrIDe public boolean onIntercepttouchEvent(MotionEvent event) { // Todo auto-generated method stubLog.v("hiiiiiiiiiii","touched"); Log.v("hiiiiiiiiiii","toucheddddddddd"); //boolean re =false; return false; }}用于
总结 以上是内存溢出为你收集整理的java – 在stackview中水平滑动全部内容,希望文章能够帮你解决java – 在stackview中水平滑动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)