【问题标题】:switching between activities using Touch screen使用触摸屏在活动之间切换
【发布时间】:2011-03-04 06:39:47
【问题描述】:

想要通过使用触摸事件拖动页面来更改活动。我用过 Flipper,但是通过使用 Flipper 动画会自动执行,但我想用手指或鼠标拖动屏幕

【问题讨论】:

    标签: android android-layout switching


    【解决方案1】:

    为此,我找到了一个非常棒的课程,这对我来说非常棒。这个不能真正切换活动,但您可以切换多个“屏幕”或“表单”。

    我在这里的那个问题中没有找到它的库(重要的是 Java 文件“DragableSpace.java”:

    Android Homescreen

    你看不到如何在你的布局中使用它,所以这是我的例子:

    <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>
    

    您可以包含任意数量的“屏幕”,这些“屏幕”基本上只是指向其他布局文件的链接。您可以通过拖动来切换这些屏幕(如主屏幕)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-08
      • 2016-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多