0
這就是我的應用程序使用可擴展列表視圖從數據庫中讀取數據然後顯示它的範圍,範圍爲3個月或12周!現在我想要的是隻顯示每週的內容!我不想顯示WEEK標籤!例如,如果在這12個星期內有任何數據,我們會顯示它(但只是標有日期標籤和數據說明),但如果不是,我們不想顯示任何內容! (不顯示星期!),我也想禁用每個項目的崩潰。自定義可擴展列表Android
這是我的適配器你正在處理
public class MyCareHeaderExpandableListAdapter extends MyCareExpandableListAdapter {
public MyCareHeaderExpandableListAdapter(Context context) {
super(context);
}
//--------------------------------------------------------------------
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
//Log.d("getChildView", "getChildView " + groupPosition);
//View view = adapter.getView(childPosition, convertView, parent);
Item item = getChild(groupPosition, childPosition);
return setContentView(R.layout.expandable_list_item, convertView, item);
}
//--------------------------------------------------------------------
@Override
public long getChildId(int groupPosition, int childPosition) {
int id = ((ScheduleItem)m_childrens.get(groupPosition).getItem(childPosition)).getID();
return id;
}
//--------------------------------------------------------------------
/**
* This function is called to generate the view for the groups.
*/
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
String name[] = getGroup(groupPosition);
// Generating header
// A header has no child, and begins the name with "Week"
//if (getChildrenCount(groupPosition) == 0 && (name[1] == null)) {
if (name[1] == null) {
convertView = m_inflater.inflate(R.layout.expandable_list_week, null);
TextView textView = (TextView)convertView.findViewById(R.id.txtHeader);
Font.setToView(textView, Font.BOLD);
textView.setText(name[0]);
}
// Generating group name
else {
//Log.d("getGroupView", name);
convertView = m_inflater.inflate(R.layout.expandable_list_group, null);
TextView textView = (TextView)convertView.findViewById(R.id.txtDay);
textView.setText(name[0]);
Font.setToView(textView, Font.BOLD);
TextView textView2 = (TextView)convertView.findViewById(R.id.txtDate);
textView2.setText(name[1]);
Font.setToView(textView2, Font.BOLD);
}
return convertView;
}
爲第二個我已經嘗試過這...這適用於對羣體禁用觸控但問題是,它只顯示今天的孩子(事件)!對於其他日子組是封閉的,當然,我們無能爲力,因爲它已經被禁用了! ,因爲你可以看到我的第一篇文章中的圖片!它顯示今天的事件,但其他的事件我們看不到! –
讓我看看我是否理解正確:(1)你不想看到週數,(2)你只想顯示日期(天),當該日期至少有一個條目,(3)所有天條目應顯示條目。我有沒有得到那個權利? – bobnoble
是的,它正是我想要的 –