【问题标题】:Static view in scrolling Viewpager in CoordinatorLayoutCoordinatorLayout 中滚动 Viewpager 中的静态视图
【发布时间】:2016-09-22 14:28:59
【问题描述】:
我目前正在开发具有 CoordinatorLayout -> Viewpager -> Framelayout(包含在片段中)的视图层次结构的应用程序。 CoordinatorLayout 确保在片段中滚动时操作栏滚动离开。
我面临的问题是,我想在片段底部有一个不滚动的视图,而是始终停留在片段的底部。视图应该只存在于其中一个片段中,这意味着将其放在 Viewpager 之外是行不通的。
是否可以在片段中创建静态视图(Framelayout)?
【问题讨论】:
标签:
android
android-fragments
scroll
android-viewpager
android-coordinatorlayout
【解决方案1】:
我不能 100% 确定这是否是您正在寻找的东西,如果它没有解释(用代码)您正在寻找什么。
祝项目顺利
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:id="@+id/coordinatorLayout"
android:fitsSystemWindows="true">
//Part that will be static
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView2">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
//part in the scrollfiew
</LinearLayout>
</ScrollView>
</RelativeLayout>