简体   繁体   English

使用触摸屏在活动之间切换

[英]switching between activities using Touch screen

want to change activities by dragging the page using touch event. 想要通过使用触摸事件拖动页面来更改活动。 I have used Flipper, but by using flipper animations are performed automatically, but i want to drag the screen by finger or by mouse 我曾经使用过Flipper,但是通过使用鳍状肢动画会自动执行,但是我想用手指或鼠标拖动屏幕

I found a really great class for that purpose which did great for me. 我为此目的找到了一门非常棒的课程,对我来说很棒。 This one isn't capable of really switching activitys but you can switch multiple "screens" or "forms". 此功能无法真正切换活动,但您可以切换多个“屏幕”或“表单”。

There is no library for that i found it in that question here (What is important is the Java File "DragableSpace.java": 我没有在这个问题的库中找到这个库(重要的是Java文件“ DragableSpace.java”:

Android Homescreen Android主萤幕

You can't see there how to use it in your layout so here is my example: 您看不到在那里如何在布局中使用它,因此这是我的示例:

<com.matthieu.launcher.DragableSpace xmlns:app="http://schemas.android.com/apk/res/com.matthieu.launcher"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/space"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<include android:id="@+id/left"  layout="@layout/artists" />
<include android:id="@+id/center"  layout="@layout/releases" />
<include android:id="@+id/right"  layout="@layout/labels" />

</com.matthieu.launcher.DragableSpace>

You can include as many "screens" as you like which basicly are just links to other layout files. 您可以根据需要添加任意数量的“屏幕”,这些“屏幕”基本上只是指向其他布局文件的链接。 Than you can switch these screens by dragging (like the homescreens). 比您可以通过拖动来切换这些屏幕(如主屏幕)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM