【问题标题】:Coordinator Layout with ViewPager and ListFragment not scrollingViewPager 和 ListFragment 的协调器布局不滚动
【发布时间】:2016-01-02 10:41:41
【问题描述】:

我在包含ListFragmentCoordinator layout 中实现了view pager。视图寻呼机工作正常,但列表不滚动,

谁能帮忙?我是否必须实现一些东西来识别触摸方向然后禁用触摸事件?

协调器布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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" android:fitsSystemWindows="true"
tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout android:id="@+id/app_bar"
        android:layout_height="wrap_content" android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.v7.widget.Toolbar android:id="@+id/toolbar"
                android:layout_height="?attr/actionBarSize" android:layout_width="match_parent"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

            <com.passwordstore.utility.SlidingTabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary" />

            <View
                android:layout_width="match_parent"
                android:layout_height="4dp"
                android:background="@android:color/white"
                android:foreground="@drawable/shadow"/>

            <android.support.v4.view.ViewPager
                android:id="@+id/pager"
                android:layout_height="0dp"
                android:layout_width="match_parent"
                android:layout_weight="1"
                android:background="@android:color/white"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

        </LinearLayout>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" android:id="@+id/frameLayout">

        <include layout="@layout/activity_password_list" />

    </FrameLayout>

    <android.support.design.widget.FloatingActionButton android:id="@+id/fabNew"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin" android:src="@drawable/ic_add_white_24dp"
        app:layout_anchor="@+id/frameLayout"
        app:layout_anchorGravity="bottom|right|end"/>

</android.support.design.widget.CoordinatorLayout>

片段 - activity_password_list:

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/item_list"
android:name="com.passwordstore.fragment.PasswordListFragment" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" tools:context=".PasswordListActivity"
tools:layout="@android:layout/list_content" />

【问题讨论】:

    标签: android android-listfragment android-coordinatorlayout


    【解决方案1】:

    同样的问题我也有同样的结果,我只需要使用这些custom layouts,你可能想看看:

    https://github.com/TheLittleNaruto/SupportDesignExample/tree/master/app/src/main/java/com/thelittlenaruto/supportdesignexample/customview

    【讨论】:

      猜你喜欢
      • 2017-04-18
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多