导航/系统栏隐藏了问题下方的布局

时间:2016-01-27 06:12:11

标签: android android-layout themes app-themes

我在我的应用程序中使用了以下主题,但它隐藏了导航栏下方的布局。

<style name="AppTheme_21" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowTranslucentStatus">false</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:editTextStyle">@style/EditTextStyle</item>
    <item name="android:spinnerStyle">@style/SpinnerColor</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

请检查附加图片:enter image description here

列表视图位于导航栏下方。我希望按照我的要求在导航栏上方显示列表视图。

请帮帮我。 感谢

Xml代码:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/menu_bg_design"
    android:orientation="vertical"
    android:weightSum="3.8">

    <LinearLayout
        android:id="@+id/statusBarBackgroundLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/margin15"
        android:clickable="false"
        android:focusable="false"
        android:orientation="horizontal"></LinearLayout>

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1.45"
        android:background="@drawable/menu_bg_design"
        android:orientation="vertical">

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

            <LinearLayout
                android:id="@+id/ll_pro"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal|top"
                android:orientation="vertical">

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal|top">

                    <LinearLayout
                        android:layout_width="@dimen/circle"
                        android:layout_height="@dimen/circle"
                        android:layout_gravity="center"
                        android:background="@drawable/hollowcircle_prof"
                        android:orientation="horizontal" />

                    <ProgressBar
                        android:id="@+id/image_progressbar"
                        style="@android:style/Widget.ProgressBar.Small"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_centerInParent="true"
                        android:layout_gravity="center"
                        android:visibility="visible" />

                    <imageloader.CircularImageView
                        android:id="@+id/img_profile"
                        android:layout_width="@dimen/margin80"
                        android:layout_height="@dimen/margin80"
                        android:layout_gravity="center"
                        android:background="@drawable/pro_pic"
                        android:gravity="center" />
                </FrameLayout>

                <fonts.TextViewRegular
                    android:id="@+id/txt_name_dash"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/padding5"
                    android:singleLine="true"
                      android:textAppearance=
            "@style/TextAppearance.AppCompat.Medium"
                    android:textColor="@android:color/white" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="@dimen/padding5"
                android:gravity="center"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <fonts.TextViewRegular
                        android:id="@+id/txt_earning"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/padding5"
                        android:singleLine="true"
                        android:textAppearance=
                        "@style/TextAppearance.AppCompat.Medium"
                        android:textColor="@android:color/white" />

                    <fonts.TextViewRegular
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/padding5"
                        android:singleLine="true"
                        android:text="@string/earnings"
                        android:textAppearance=
                        "@style/TextAppearance.AppCompat.Small"
                        android:textColor="@android:color/white" />
                </LinearLayout>

                <View
                    android:layout_width="1px"
                    android:layout_height="@dimen/margin60"
                    android:layout_gravity="center"
                    android:layout_marginBottom="@dimen/padding5"
                    android:layout_marginTop="@dimen/padding5"
                    android:background="@android:color/white" />

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <fonts.TextViewRegular
                        android:id="@+id/txt_totalactivity"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/padding5"
                        android:singleLine="true"
                        android:textAppearance=
                        "@style/TextAppearance.AppCompat.Medium"
                        android:textColor="@android:color/white" />

                    <fonts.TextViewRegular
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/padding5"
                        android:singleLine="true"
                        android:text="@string/total_activity"
                        android:textAppearance=
                        "@style/TextAppearance.AppCompat.Small"
                        android:textColor="@android:color/white" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2.35"
        android:orientation="vertical"
        android:weightSum="3">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1.2"
            android:background="@android:color/white"
            android:gravity="center_vertical"
            android:orientation="vertical"
            android:paddingLeft="@dimen/margin20"
            android:paddingRight="@dimen/margin20">

            <fonts.TextViewRegular
                android:id="@+id/txt_desc_dash"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=                
       "@string/
       you_can_now_start_completing_missions_to_get_more_missions"
                android:textAppearance=
        "@style/TextAppearance.AppCompat.Small"
                android:textColor="@color/text_grey_dark" />

            <fonts.TextViewHead
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/enjoy_the_missions"
                android:textAppearance="@style/TextAppearance.AppCompat.Small"
                android:textColor="@color/text_grey_dark" />

            <fonts.TextViewHead
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/margin10"
                android:text="@string/available_mission"
                android:textAppearance="
                @style/TextAppearance.AppCompat.Medium"
                android:textColor="@color/orange_bgcolor" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1.8"
            android:background="@android:color/white"
            android:orientation="vertical">

            <ListView

                android:id="@+id/list_avialmission"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:divider="@null"
                tools:listitem=
                "@layout/element_availmission_dashboard">  
               </ListView>

            <fonts.TextViewHead
                android:id="@+id/txt_no_mission"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="No Missions."
                android:textAppearance=
                "@style/TextAppearance.AppCompat.Medium.Inverse"
                android:textColor="@color/text_grey_light"
                android:visibility="gone" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

<LinearLayout
    android:id="@+id/progressBarLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@android:color/transparent"
    android:clickable="true"
    android:gravity="center"
    android:visibility="gone">

    <ProgressBar
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="visible" />
</LinearLayout>

2 个答案:

答案 0 :(得分:1)

只需使用android:clipToPadding =“false”

从伊恩湖拍摄: https://medium.com/google-developers/why-would-i-want-to-fitssystemwindows-4e26d9ce1eec#.5yuy2c40s

答案 1 :(得分:0)

当然应该是这样,当然您使用的是FrameLayoutListView

将您的内容(布局)放在CoordinatorLayout内和NestedScrollview内。然后,当用户将其拉下来时,它会折叠AppBarLayout内容(例如,你的情况下的粉红色部分)然后用户将能够看到下面布局的内容(在这种情况下,ListView内容)。

否则,如果您使用FrameLayout作为根标记,那么这不是一起使用ListViewFrameLayout的好方法。

您可能需要查看Android Design Support Library