我需要在 Android 中将一个布局滑动到另一个布局上。
要求。
1 . 布局 1 覆盖了 80% 的屏幕,其余部分由布局 2 占据。
2 .我需要能够在布局1之上滑动布局2, 布局 2 的总宽度或可滚动限制应该是这样的 布局 1 的 20% 应在下方可见。
3 .然后我需要将布局2滑回到其原始位置。
我尝试过可能的滑动教程,包括
以及互联网上提供的许多其他教程。
这些都无法提供我所需要的,我尝试了很多自定义并花了将近一周的时间,
有人可以帮忙吗
最佳答案
明白了!!...简单是最好的。没有库,没有复杂的代码。使用 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/