laobie / StatusBarUtil

A util for setting status bar style on Android App.
http://t.cn/Rq746Kb
Apache License 2.0
8.81k stars 1.72k forks source link

魅族设置图片占满状态栏的问题 #124

Open zmylls opened 7 years ago

zmylls commented 7 years ago

在activity中设置的 效果 image

布局 ` <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/darker_gray" android:orientation="vertical">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="280dp">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">

            <ImageView
                android:id="@+id/iv_movie_poster"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:fitsSystemWindows="true"
                android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                android:theme="@style/AppTheme.Toolbar"
                app:layout_collapseMode="pin"/>

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

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

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/scroll_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:overScrollMode="never"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

            <TextView
                android:id="@+id/movie_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:textColor="@android:color/white"
                android:textSize="32sp"/>

            <TextView
                android:id="@+id/movie_year"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:fontFamily="sans-serif-light"
                android:textAppearance="@style/TextAppearance.AppCompat.Small"
                android:textColor="@android:color/white"/>

            <TextView
                android:id="@+id/movie_rating"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:fontFamily="sans-serif-light"
                android:textAppearance="@style/TextAppearance.AppCompat.Small"
                android:textColor="@android:color/white"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="32dp"
                android:text="Summary"
                android:textAppearance="@style/TextAppearance.AppCompat.Title"
                android:textColor="@android:color/white"/>

            <TextView
                android:id="@+id/movie_description"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"
                android:fontFamily="sans-serif-light"
                android:lineSpacingMultiplier="1.2"
                android:textAppearance="@style/TextAppearance.AppCompat.Body1"
                android:textColor="@android:color/white"/>

            <include
                layout="@layout/layout_trailers_and_reviews"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"/>
        </LinearLayout>

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

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

// StatusBarUtil.setTranslucentForCoordinatorLayout(this,0); // StatusBarUtil.setTranslucentForImageView(this,mToolbar); // StatusBarUtil.hideFakeStatusBarView(this); 这几个方方法均试过,不起作用,外层套了LinearLayout也不起作用 魅族M463C ,android 4.4.4

DuoLa512 commented 7 years ago

我也出现你这个问题,你解决了吗?大佬