ExpandableListView 可折疊列表

2021-07-24 15:26:27 字數 1785 閱讀 6479

baseexpandablelistadpter分成了兩部分:組和子列表

1、布局中的一些屬性

android:childdivider:指定各組內子類表項之間的分隔條,不會完全顯示, 分離子列表項的是一條直線

android:childindicator:顯示在子列表旁邊的drawable物件,可以是乙個影象

android:childindicatorend:子列表項指示符的結束約束位置

android:childindicatorleft:子列表項指示符的左邊約束位置

android:childindicatorright:子列表項指示符的右邊約束位置

android:childindicatorstart:子列表項指示符的開始約束位置

android:groupindicator:顯示在組列表旁邊的drawable物件,可以是乙個影象

android:indicatorend:組列表項指示器的結束約束位置

android:indicatorleft:組列表項指示器的左邊約束位置

android:indicatorright:組列表項指示器的右邊約束位置

android:indicatorstart:組列表項指示器的開始約束位置

2、建立儲存組資料的集合,和儲存子列表的集合

3、自定義介面卡繼承baseexpandablelistadpter類

public

class 自定義介面卡 extends

baseexpandablelistadapter

@override

public

intgetchildrencount(int groupposition)

@override

public object getgroup(int groupposition)

@override

public object getchild(int groupposition, int childposition)

@override

public

long

getgroupid(int groupposition)

@override

public

long

getchildid(int groupposition, int childposition)

@override

public

boolean

hasstableids()

//取得用於顯示給定分組的檢視. 這個方法僅返回分組的檢視物件

@override

public view getgroupview(int groupposition, boolean i***panded, view convertview, viewgroup parent)

//取得顯示給定分組給定子位置的資料用的檢視

@override

public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent)

//設定子列表是否可選中

@override

public

boolean

ischildselectable(int groupposition, int childposition)

}

純CSS打造可折疊樹狀選單

1 html 下級 下級下級 無限級無限級 無限級無限級 無限級無限級 實現的思路是運用checkbox的checked值來判斷下級欄目是否展開,css3的選擇器中提供了 checked 這個偽類,這個偽類提供我們,當元素擁有checked這個值的時候就執行你的css。很強大是吧。有了css3我們會...

Android 使用屬性動畫實現可折疊布局

剛剛了解屬性動畫,嘗試著寫了乙個可折疊布局,正好也是專案中用到的。先上效果圖 使用了乙個自定義布局,很簡單,就是指明了需要改變的屬性,本例中既是布局的高度 public class foldpanellayout extends relativelayout private void setpane...

小公尺或在今年推出首款可折疊手機,採用內摺疊設計

程式設計客棧 www.cppcns.com 3月5日訊息 日前據ross young爆料訊息稱,小公尺首svyotfe款摺疊手機即將發布svyotfe。據最新訊息透露,這款新裝置的官方名稱可能是小公尺mix系列。此前訊息稱,小公尺摺疊屏新機將採用與華為mate xs類似的外摺疊手機,這款裝置摺疊後的...