opacapp / multiline-collapsingtoolbar

A modified CollapsingToolbarLayout that can deal with multiline titles
Other
783 stars 114 forks source link

adding image to header #8

Closed aradhell closed 8 years ago

aradhell commented 8 years ago

Hello,

I cudnt find how to add an image to header, when i try,

`<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">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:theme="@style/AppTheme.AppBarOverlay"
    android:background="?attr/colorPrimary"
    android:fitsSystemWindows="true">

    <net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        app:title="sdfsdf">

        <ImageView
            android:id="@+id/cover_image"
            android:layout_width="match_parent"
            android:layout_height="120dp"
            android:background="@color/white"
            android:fitsSystemWindows="true"
            android:scaleType="fitXY"
            android:src="@drawable/lcw"
            app:layout_collapseMode="parallax" />

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

    </net.opacapp.multilinecollapsingtoolbar.CollapsingToolbarLayout>

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

<com.github.ksoichiro.android.observablescrollview.ObservableScrollView
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        android:text="@string/lipsum" />

</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>

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

results,

http://i.imgur.com/7y9Ztsj.png

and with NestedScrollView

`<android.support.v4.widget.NestedScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        android:text="@string/lipsum" />

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

http://i.imgur.com/DJpkNJH.png http://i.imgur.com/EsPhZTE.png

aradhell commented 8 years ago

my bad