我正在开发Android项目。现在我必须创建我自己的可扩展列表。这是我遵循的解决方案:getGroupView设置类似于Android项目中的Simple_Expandable_List_item项目
link to source code of expandable list that I am working on
而这其中产生了我的TextView(从列表中它的元素)的代码。我想创建而不是这个TextView的东西像android.R.layout.simple_expandable_list_item项目。我的意思是把一些图片放在左边,然后是文字。我该怎么做?
我试过用Button和Button设置左边的图标,但它没有帮助。按钮不会展开/折叠我的列表。
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
TextView tv = new TextView(Vincent_ThreeelevellistActivity.this);
tv.setText("->FirstLevel");
tv.setTextColor(Color.BLACK);
tv.setTextSize(20);
tv.setBackgroundColor(Color.BLUE);
tv.setPadding(10, 7, 7, 7);
return tv;
}