yılında
private val shows = listOf("First", "Breaking Bad", "Game of Thrones", "Bob and Martin...")
private val expandableListView: ExpandableListView by bind(R.id.theListView)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//Add items to expandable list view here
}
sayesinde iyi çalıştı: Bu benim iskelet kodudur.
private ArrayList<HeaderInfo> SectionList = new ArrayList<>();
...
//create the adapter by passing your ArrayList data
listAdapter = new ExpandableListAdapter(MyListActivity.this, SectionList);
//attach the adapter to the list
expandableListView.setAdapter(listAdapter);
Bu benim genişletilebilir liste adaptörü
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context context;
private ArrayList<HeaderInfo> SectionList;
public ExpandableListAdapter(Context context, ArrayList<HeaderInfo>
SectionList) {
this.context = context;
this.SectionList = SectionList;
}
...
tarihinde "ExpandableListView örneği" de yapıcı ve bunu anlamaya mümkün olmalıdır: Eğer listData tanımlamak etkinlik olarak
bunu. – rozina
Evet, setAdapter işlevini buldum. Sadece bir ExpandableListAdapter oluşturma mücadelesi gibi görünüyor. Sadece bir ArrayAdapter çalışmamı başardım, bu da bana fazla yardımcı olmuyor. – OhMad