簡體   English   中英

使用AppBarLayout和Toolbar的自定義標題布局

[英]Custom header layout with AppBarLayout and Toolbar

如何使用Toolbar和AppBarLayout開發我的自定義標頭?我想使用此添加自己的自定義xml。

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

<android.support.v7.widget.Toolbar

android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:supportsRtl="false"
app:popupTheme="@style/AppTheme.PopupOverlay">


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

嘗試這樣的事情:

<android.support.v7.widget.Toolbar
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:id="@+id/toolbar"
         android:layout_height="?attr/actionBarSize"
         app:popupTheme="@style/AppTheme">

            <android.support.constraint.ConstraintLayout
    android:id="@+id/ConstraintContainer"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:background="@android:color/black"
    android:gravity="center"
    android:layout_height="wrap_content">

    <!--Whatever textview/imageview you want to insert-->

            </android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM