android - 在android中将一个布局滑动到另一个布局上

标签 android slide sliding jfeinstein

我需要在 Android 中将一个布局滑动到另一个布局上。

要求。

1 . 布局 1 覆盖了 80% 的屏幕,其余部分由布局 2 占据。

enter image description here

2 .我需要能够在布局1之上滑动布局2, 布局 2 的总宽度或可滚动限制应该是这样的 布局 1 的 20% 应在下方可见。

enter image description here

3 .然后我需要将布局2滑回到其原始位置。

enter image description here

我尝试过可能的滑动教程,包括

Sliding Menu by Jfeinstein

Slide Panel Layout - Android

以及互联网上提供的许多其他教程。

这些都无法提供我所需要的,我尝试了很多自定义并花了将近一周的时间,

有人可以帮忙吗

最佳答案

明白了!!...简单是最好的。没有库,没有复杂的代码。使用 SimplePaneLayout。

只需将 android:layout_marginLeft 设置为合适的值即可。 :) 太棒了 :)

<android.support.v4.widget.SlidingPaneLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/slidingpanelayout">

        <LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="#CCC"
                  android:orientation="horizontal"
                  android:id="@+id/fragment_firstpane"/>

        <LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="#000"
                  android:orientation="horizontal"
                  android:layout_marginLeft="40dp"
                  android:id="@+id/fragment_secondpane"/>

    </android.support.v4.widget.SlidingPaneLayout>

关于android - 在android中将一个布局滑动到另一个布局上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23732939/

相关文章:

android - ListView 标题拉伸(stretch)

android - NavigationDrawer 不显示 View

javascript - 试图滑开/以 jquery 效果

jQuery .slideRight 效果

css - 滑动可扩展内嵌菜单

java - 无法使用不可重复的请求实体重试请求

toggle - 如何用jQuery实现下面的滑动/切换效果?

javascript - 如何制作随滚动变化的垂直 slider ?

javascript - 究竟是什么阻止了该脚本在 IE8 中运行? (IE8问题)

java - 代码 401,需要登录,同时在 Android 上使用 YouTube Data API V3