2016-06-29 2 views
0

左の引き出しアイコン、右のメニューアイテム、およびプレイストアや添付された画面に類似した検索ビューを持ち、パディングを持つツールバーを作成する方法。私が直面している問題はツールバーのパディングであり、ツールバーは常にコーナーに付けられています。パディングとメニューオプション付きのAndroidツールバー

XMLコード:

<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ストア画面]

enter image description here

+0

あなたがこれまでに書いたツールバー/ xmlコードを共有することができればそれは素晴らしいことです。 –

+0

あなたの質問は広すぎます。 –

+0

@AshishRanjanは –

答えて

0

私はサポートライブラリを使用して、この近くに何かを得ることができましたNoActionBarスタイル:01

<?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> 
<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は、その素敵な影がGoogle Playが持っていることを見て取得するには、バックグラウンドのために9パッチを使用する必要があります。

関連する問題