2016-03-20 32 views
0

我想在我的白色工具欄的底部添加一個灰色邊框,以便它與主內容明顯分離。我設置了我的工具欄是這樣的:如何讓我的工具欄底部的邊框?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:orientation="vertical" 
android:id="@+id/pick_root_layout"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/pick_toolbar" 
    android:layout_height="?attr/actionBarSize" 
    android:layout_width="match_parent" 
    android:minHeight="?attr/actionBarSize" 
    app:theme="@style/Toolbar.White" 
    android:background="@color/white"> 
</android.support.v7.widget.Toolbar> 

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/swipe_refresh_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <ListView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/conversation_list"> 
    </ListView> 

</android.support.v4.widget.SwipeRefreshLayout> 

</LinearLayout> 

我需要那個也隨之滾動,當我移動工具欄的底部添加一個小灰線。我怎樣才能做到這一點?如果可能,我想避免製作自定義佈局。

+0

這聽起來像你想,當你滾動列表視圖,將保持連接到工具欄工具欄上的陰影類型的效果,這是正確的? – TrevJonez

回答

0

如果您試圖添加將保持附加到工具欄的陰影類型效果,獲取此的一個簡單方法是將您的SwipeRefreshLayout與FrameLayout包裝在一起,並在FrameLayout上放置一個前景。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:orientation="vertical" 
    android:id="@+id/pick_root_layout"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/pick_toolbar" 
     android:layout_height="?attr/actionBarSize" 
     android:layout_width="match_parent" 
     android:minHeight="?attr/actionBarSize" 
     app:theme="@style/Toolbar.White" 
     android:background="@color/white"/> 

     <FrameLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:foreground="@drawable/bottom_shadow"> 

      <android.support.v4.widget.SwipeRefreshLayout 
       android:id="@+id/swipe_refresh_layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <ListView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/conversation_list" /> 

      </android.support.v4.widget.SwipeRefreshLayout> 
     </FrameLayout> 
</LinearLayout> 

陰影9補丁 - >bottom_shadow.9.png

相關問題