android LinearLayout添加分隔線

來源:互聯網
上載者:User

標籤:android   style   blog   http   color   os   io   strong   

方法一:可以放置一個ImageView組件,然後將其設為分隔線的顏色或圖形。分隔線View的定義代碼如下:[html] view plaincopy 
  1. <ImageView   
  2.         android:layout_width="fill_parent"  
  3.         android:layout_height="1dp"  
  4.         android:background="#ffffff"  
  5.         />  
效果如下:方法二:在 Android3.0及以上版本,LinearLayout支援直接顯示分隔線。設定<LinearLayout>標籤的 android:showDividers屬性可以再LinearLayout的相應位置顯示分隔線。如果有多個LinearLayout,顯示效果和在 LinearLayout之間加分隔線是一樣的。android:showDividers屬性可以設定如下4個值:none:不顯示分隔線;beginning:在LinearLayout的開始處顯示分隔線;end:在Linearlayout的結尾處顯示分隔線;middle:在LinearLayout中的每兩個組件間顯示分隔線:除了需要設定android:showDividers屬性外,還要設定android:divider屬性,該屬性工作表示分隔線的映像,需要一個Drawable ID 更多參考:http://www.dajo.com.cn/a/boke/anzhuo/2013/1030/86.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.