Потерять функцию просмотра списка, используя SwipeRefreshLayout и DrawerLayout ay
Я использую оба SwipeRefreshLayout и DrawerLayout в одном и том же XML. Однако ящик работает отлично. Но я не могу смахнуть список. Что-то не так с xml?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.einverne.inoreader.Activity.MainActivity">
<include
android:id="@+id/toolbar_actionbar"
layout="@layout/toolbar_default"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_below="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_actionbar"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_actionbar">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false" />
<fragment
android:id="@+id/fragment_drawer"
android:name="com.einverne.inoreader.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
1 ответ
Решение
Я изменяю свой layout.xml на это, чтобы решить проблему:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- The navigation drawer -->
<com.einverne.inoreader.ScrimInsetsFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrimInsetsFrameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="10dp"
android:fitsSystemWindows="true">
<!-- The navigation drawer content -->
</com.einverne.inoreader.ScrimInsetsFrameLayout>
<!-- The main content -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar_actionbar"
layout="@layout/toolbar_default"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true">
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_below="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_actionbar"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
</LinearLayout>
<fragment
android:id="@+id/fragment_drawer"
android:name="com.einverne.inoreader.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>