Android--ListView 分割線

來源:互聯網
上載者:User

標籤:android   android開發   

  1. <LinearLayout
  2. xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content">
  5. <ListView
  6. android:id="@+id/android:list"
  7. android:layout_width="wrap_content"
  8. android:layout_height="wrap_content"
  9. android:divider="#FFCC00"
  10. android:dividerHeight="4px"/>
  11. </LinearLayout>

在Android平台中系統控制項提供了靈活的自訂選項,所有基於ListView或者說AbsListView實現的widget控制項均可以通過下面的方法設定行間距的分割線,分割線可以自訂色彩、或圖片。

在ListView中我們使用屬性 android:divider="#FF0000" 定義分隔字元為紅色,當然這裡值可以指向一個drawable圖片對象,如果使用了圖片可能高度大於系統預設的像素,可以自己設定高度比如6個像素 android:dividerHeight="6px" ,Android開發網提示當然在Java中ListView也有相關方法可以設定。


其他精彩文章文章

 android學習筆記(38)使用ProgressDialog建立進皮對話方塊
大型網站架構設計-Solr
android學習筆記(39)訊息提示使用Toast昱示提示資訊輕
android學習筆記(32)網格視圖(GridView )和圖形切換器(ImageSwi...
android學習筆記(31)可展開的列表組件(ExpandableListView )
更多關於android開發文章

Android--ListView 分割線

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.