Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image in the appBarLayout

What I want to achieve is almost the same result as is on picture, but without collapsing and with tab layout under toolbar text. I got it done using CollapsingTollbarLayout, but I don't think that's a good way if I don't want it to colapse. How should I properly implement the image, so it's under the toolbar and tab layout ?

Example

like image 268
Robert Vangor Avatar asked Dec 02 '22 15:12

Robert Vangor


1 Answers

Ok, here is the solution :

 <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/imageViewplaces"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:src="@drawable/pyrros" />

        <android.support.design.widget.TabLayout
            android:id="@+id/caj_tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/imageViewplaces"
            android:elevation="6dp"
            android:minHeight="?attr/actionBarSize"
            app:tabTextAppearance="@style/MineCustomTabText"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            android:layout_marginTop="12dp"
            app:titleTextAppearance="@style/Toolbar.TitleText" />

    </RelativeLayout>


</android.support.design.widget.AppBarLayout>
like image 158
Robert Vangor Avatar answered Dec 05 '22 04:12

Robert Vangor