Подтвердить что ты не робот

SwipeRefreshLayout скрывается за ActionBar с прозрачными барами состояния

У меня возникают проблемы с отображением SwipeRefreshLayout при использовании прозрачной навигации и столбцов состояния (API-уровень 19). То есть, в настоящее время он находится в строке состояния (вверху экрана), когда я хочу, чтобы он находился под панелью действий.

ListView работает как ожидалось. То есть, контент правильно отображается за навигационными панелями и не скрывается под строкой состояния или панель действий.

С учетом сказанного, если я добавлю свойство android: fitsSystemWindows = "true" в мой относительный макет, SwipeRefreshLayout работает правильно. Но это делает мой список невидимым в прозрачных навигационных барах. Вместо этого панели навигации являются просто цветом моего фона и не позволяют показывать содержимое из моего списка.

Как я могу заставить ListView оставаться таким, как сейчас, а также получить видимость SwipeRefreshLayout (вместо того, чтобы быть скрытым в строке состояния в верхней части экрана)?

Ниже мой макет:

<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingTop="10dp"
            android:background="#ccc"
            android:clipToPadding="false">

            <android.support.v4.widget.SwipeRefreshLayout
                android:id="@+id/swipe_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            <FrameLayout
                android:id="@+id/container"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="#ccc">

                <ListView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:id="@+id/listView"
                    android:paddingTop="10dp"
                    android:fitsSystemWindows="true"
                    android:clipToPadding="false"
                    android:divider="@android:color/transparent"
                    android:layout_gravity="left|top" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:text="No Internet Connection"
                    android:id="@+id/noInternet"
                    android:textColor="@android:color/secondary_text_light"
                    android:layout_gravity="center" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="Pull To Refresh"
                    android:translationY="20dp"
                    android:id="@+id/nointernetSub"
                    android:textColor="@android:color/secondary_text_light"
                    android:layout_gravity="center" />

            </FrameLayout>

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

        </RelativeLayout>

    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:name="com.package.app.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>
4b9b3361

Ответ 1

Я бы рекомендовал использовать margin

android:layout_marginTop="?android:attr/actionBarSize"