擴充套件的ListView例項

2021-09-01 01:21:29 字數 925 閱讀 3395

今天從網上看了個擴充套件的listview的例子,感覺還蠻炫,自己也試著做了下。

由於比較簡單,所有就直接上**:

public class extendedlistview extends expandablelistactivity public class myexpandablelistadapter extends baseexpandablelistadapter; public string childrens=,,}; public object getchild(int groupposition, int childposition) public long getchildid(int groupposition, int childposition) public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent) //新建乙個textview public textview getgenericview() public int getchildrencount(int groupposition) public object getgroup(int groupposition) public int getgroupcount() public long getgroupid(int groupposition) public view getgroupview(int groupposition, boolean i***panded, view convertview, viewgroup parent) public boolean hasstableids() public boolean ischildselectable(int groupposition, int childposition) } }

看一下執行在模擬器上的效果:

ThinkPHP的Widget擴充套件例項

thinkphp的wid擴充套件用於根據頁面需要輸出不同內容,它在專案目錄中的lib widget下定義。具體定義如下 class newslistwidget extends widge程式設計客棧t 需要注意 1.widget是乙個抽象類,其中有乙個抽象方法 abstract render,必須...

ListView巢狀ListView的思路

1.在activity中,布局中新增原生listview作為 父listview 2.在父listview中新增自定義的 子listview 3.子listview中的布局為單個item的布局。4.書寫父listview的adapter public class eventcitylistadapt...

Listview巢狀Listview的實現方法

第一種方法 重寫listview的onmeasure方法 public class childlistview extends listview public childlistview context context,attributeset attrs,int defstyle public c...