2016-03-29 10 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の左余白を削除できます