Sac*_*and 3 android expandablelistview
我有一个扩展列表视图,我想在扩展特定组时更改组的文本颜色.我尝试了很多东西,但无法找到解决方案.如果有任何解决方案,请告诉我
在您使用的适配器中,您应该重写该getGroupView()
方法.您获得的参数之一是isExpanded
布尔值.只需使用该值来确定要设置textview的颜色.这是一个例子:
@Override
public void getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// Here you would do your convertView initialization
// ...
TextView textView = (TextView) convertView.findViewById(R.id.textview);
if(isExpanded)
textView.setTextColor(/* some color */);
else
textView.setTextColor(/* some other color */);
// Do the rest of your view binding
//...
}
Run Code Online (Sandbox Code Playgroud)