2016-02-28 65 views
1

我注意到PlayStore上近期应用中使用的这种类型的工具栏,我需要做到这一点。Android - 我如何实现这种类型的工具栏?

enter image description here

我知道如何创建XML一个简单的工具栏。

简单工具栏

<android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:background="@color/ColorPrimary" 
      android:layout_height="?attr/actionBarSize" 
      app:layout_collapseMode="pin" 
      android:theme="@style/about_toolbar" 
      > 
... 

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

我好像用填充工具栏。

所以我不完全确定。 请有人这样做可以帮助我!

+0

,您是否试图将边缘? –

+0

谢谢@DavidMedenjak,边距工作,但它缺少阴影和用户界面的感觉,这是我张贴的图像。 –

+0

检查我的答案的影子 –

回答

2

例与cardView:

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#bcbcbc" 
     > 
     <android.support.v7.widget.CardView 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:layout_alignParentTop="true" 
      android:layout_margin="20dp" 
      android:background="@android:drawable/dialog_holo_light_frame" 
      /> 
    </RelativeLayout> 

enter image description here

+0

它的工作,请删除第一个例子如此以免混淆人心! –

+0

很高兴为您效劳 –

相关问题