elf*_*foz 1 java android expandablelistview navigation-drawer
我尝试在导航抽屉中创建一个ExpandableListView.我尝试了一个示例代码但是在编译之前我遇到了这个错误.
public class MainActivity extends Activity {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// get the listview
expListView = (ExpandableListView) findViewById(R.id.left_drawer);
// preparing list data
prepareListData();
listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
Run Code Online (Sandbox Code Playgroud)
错误在这一行:listAdapter = new ExpandableListAdapter(this,listDataHeader,listDataChild);
为什么它说无法实例化ExpandableListAdapter类型?
Rob*_*ood 10
ExpandableListAdapter也是android.widget.ExpandableListAdapter中的一个接口看起来你正在导入它,这是试图实例化你的本地ExpandableListAdapter类.
重命名你的ExpandableListAdapter.
| 归档时间: |
|
| 查看次数: |
5844 次 |
| 最近记录: |