我正在创建这个exapandlelist,工作正常。但现在我有兴趣在页面按钮上创建按钮。似乎代码清除了所有布局并创建了一个新的。因此,当我添加一个按钮文本或其他文本时,这将被删除。
如何阻止删除布局?
代码来自:http://www.learn-android-easily.com/2013/07/android-expandablelistview-example.html
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); //gemmer sidste tilstand
// Create Expandable List and set it's properties
ExpandableListView expandableList = getExpandableListView();
expandableList.setDividerHeight(2);
expandableList.setGroupIndicator(null);
expandableList.setClickable(true);
// Set the Items of Parent and child
prepareListData();
// Create the Adapter
adapter = new MyExpandableAdapter(parentParam, childItems);
//setListAdapter(adapter);
//ExpandableListView listView = (ExpandableListView) findViewById(R.id.listView);
adapter.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), this);
adapter.notifyDataSetChanged();
// Set the Adapter to expandableList
expandableList.setAdapter(adapter);
expandableList.setOnChildClickListener(this);
}