繁体   English   中英

需要从主活动向左轻扫以进入其他活动

[英]Need something Swipe Left from Main Activity to go into another Activity

我正在制作一个仅具有应用程序名称的Android启动器(图标被隐藏了,因为我只是希望它非常简单。

在主要活动中,我列出了GridView中安装的所有应用程序。 (我想将其更改为仅显示选定的收藏夹应用程序)

我还有另一项活动,其中所有应用程序都显示有搜索功能。

我希望能够从“主要活动”切换到“完整应用”页面,以及通过滑动切换回“主要活动”。

因此,向左滑动即可带动从该页面向右滑动(应用程序的GridView)的应用程序页面(希望恢复上一个活动)

我尝试了几种不同的解决方案,但都不是理想的解决方案,因为大多数解决方案都无效,并且只有从顶部开始滑动才可以解决。

左右滑动更改活动

我已经尝试了上面链接中提供的第一个解决方案

我要向左滑动的主要活动页面 我要向右滑动的应用活动页面

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/MainActivity"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">


<LinearLayout
    android:id="@+id/top_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextClock
        android:id="@+id/clock"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/white"
        android:textSize="40sp" />

    <TextView
        android:id="@+id/dateView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/white"
        android:textSize="20sp" />


</LinearLayout>
<LinearLayout
    android:id="@+id/MainActivityApp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="6">
    <GridView
        android:id="@+id/appGrids"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:numColumns="1"
        android:stretchMode="columnWidth">

    </GridView>

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_weight="2">
    <ImageView
        android:id="@+id/setting"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:contentDescription="@string/app_name"
        app:srcCompat="@android:drawable/ic_menu_manage"
        />


</LinearLayout>

</LinearLayout>

嗨,看看吧,尝试一下此操作,使手势指向左下右,然后在左侧区域中调用您的下一个活动意图:Android:如何处理从右向左滑动的手势

暂无
暂无

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

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