2016-06-29 9 views
0

So erstellen Sie eine Symbolleiste mit Symbol der linken Schublade, rechte Menüelemente und Suchansicht ähnlich wie Play Store und angeschlossenen Bildschirm und mit der Auffüllung. Das Problem, mit dem ich konfrontiert bin, ist das Auffüllen der Symbolleiste, die Symbolleiste wird immer an Ecken angebracht.Android-Symbolleiste mit Auffüllen und Menüoption

xml-Code:

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appBarLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"><!--scroll|exitUntilCollapsed--> 


    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"> 

     <fragment 
      android:id="@+id/frg_searcheader" 
      class="com.vconnect.store.ui.fragment.searchpage.HomePageHeaderPagerFragment" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar_actionbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:minHeight="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
      app:theme="@style/Widget.AppCompat.Light.ActionBar" /> 


    </android.support.design.widget.CollapsingToolbarLayout> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tabLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/dark_gray" 
     android:clickable="true" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:tabGravity="fill" /> 

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

<android.support.v4.view.ViewPager 
    android:id="@+id/viewPager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

[Play Store-Bildschirm]

enter image description here

+0

wäre es toll, wenn Sie den Toolbar/XML-Code teilen könnten, den Sie bisher geschrieben haben. –

+0

Ihre Frage ist zu breit. –

+0

Bitte teilen Sie Ihren Layout-XML-Code, wie @AshishRanjan sagte –

Antwort

0

konnte ich etwas in der Nähe dieses erhalten, die Unterstützung Bibliothek mit NoActionBar Stil:

<android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/toolbar_bkgd" 
     android:padding="8dp"> 

     <android.support.v7.widget.Toolbar 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"/> 

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

toolbar_bkgd.xml

<?xml version="1.0" encoding="utf-8"?> 
<inset 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:insetBottom="8dp" 
    android:insetLeft="8dp" 
    android:insetRight="8dp" 
    android:insetTop="8dp"> 
    <shape 
     android:shape="rectangle"> 

     <solid android:color="@android:color/white"/> 
     <corners android:radius="8dp"/> 
    </shape> 

</inset> 

Um den schöne Schatten zu sehen bekommen, dass Google Play hat, müßten Sie eine Neun-Patch für den Hintergrund verwenden.

Verwandte Themen