2016-03-29 69 views
1

我想实现的扩展应用栏是这样的:扩展应用程序栏?

screenshot

但我不知道怎么办呢,我一直在寻找了一段时间,但现在整个事情还没有来这解释了如何做到这一点,所以现在我在这里。

我当前工具栏我的XML代码是

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/toolbar_add_activity" 
android:layout_width="match_parent" 
android:layout_height="232dp" 
android:minHeight="56dp" 
android:background="@color/colorPrimary" 
android:elevation="4dp" 
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
> 

但我不知道该怎么继续,如果任何人都可以举一个例子,指出我在正确的方向,或者提供一个教程,将是巨大的。

在此先感谢!

回答

1

我不知道如果这是这样,因为我无法找到任何例子或者它是如何实现正确的解释正确的方式,但此刻我已经使用此代码固定它:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 

android:id="@+id/toolbar_add_activity" 
android:layout_width="match_parent" 
android:layout_height="232dp" 
android:minHeight="56dp" 
android:background="@color/colorPrimary" 
android:elevation="4dp" 
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 


<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_marginTop="56dp" 
    android:layout_marginLeft="72dp"> 

    <android.support.design.widget.TextInputLayout 
     android:id="@+id/input_title" 
     android:layout_width="match_parent" 
     android:layout_height="80dp" 
     android:layout_marginBottom="8dp"> 
    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText8" 
     android:hint="Title" /> 
</android.support.design.widget.TextInputLayout> 

<android.support.design.widget.TextInputLayout 
    android:id="@+id/input_description" 
    android:layout_width="match_parent" 
    android:layout_height="72dp" 
    android:layout_marginBottom="16dp"> 
    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText9" 
     android:hint="Description" /> 
</android.support.design.widget.TextInputLayout> 
</LinearLayout> 
</android.support.v7.widget.Toolbar> 

而且它看起来像这样(我不能因为没有足够的代表嵌入图片还):image

它没有在左上角的“回归”的箭头,这是另一时间

如果有人能证实这是正确的方式或提供e这样做的正确方式非常棒!

编辑:激活工具栏中的向上箭头以回到父活动会自动给出线性布局中的文本输入左边距,因此您可以删除72dp左边距