2014-11-19 24 views
8

Destek v7 araç çubuğunu kullanıyorum. Özel bir görünüm ekledim, ancak özel görünüm "match_parent" ye uymuyor gibi görünüyor. Sadece gördüğü ilk simge kadar uzar. Bunun bir düzeltmesi bilen var mı? Yoksa araç çubuğu bu şekilde kullanılmamalıdır?Destek Araç Çubuğunun genişliğini tam olarak görmediği görünüm

enter image description here

Kodum:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:clipChildren="false" 
    tools:context="com.example.activities.ToolbarActivity" 
    > 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_height="100dp" 
     android:layout_width="match_parent" 
     android:minHeight="?attr/actionBarSize" 
     android:background="@color/light_gray" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
     app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:gravity="bottom" 
     android:clipChildren="false" 
     > 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="30dp" 
      android:background="@color/green" 
      > 


     </RelativeLayout> 

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

</FrameLayout> 
+0

sadece bu soruya yapılır şeyleri yapmaya çalışıyor musunuz. http://stackoverflow.com/questions/26848843/how-to-create-a-card-toolbar-using-appcompat-v7/26849046 – Simon

cevap

1

Simon'ın linkte yaklaşımla başarılı adres:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:clipChildren="false" 
    tools:context="com.example.activities.ToolbarActivity"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_height="100dp" 
     android:layout_width="match_parent" 
     android:minHeight="?attr/actionBarSize" 
     android:background="@color/light_gray" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
     app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:layout_marginTop="70dp" 
     android:background="@color/green"> 

    </RelativeLayout> 

</RelativeLayout>