2013年7月21日星期日

android ListView encounter problems with titles

    I want to do a split into A and B group listview, listview idea is itself the title of count plus the AB group which is 2, and then through getview positon to determine, in accordance with what is displayed, but I found that if position == 0 for the A's title, convertview not be empty, and puzzling, neighborhoods Great God, getview structure code below
 public View getView (final int position, View convertView, ViewGroup parent) 
{
if (position == 0)
{ return myInflater.inflate (R.layout.item_title, null); / / Show title
} else { / / Display content

ViewHolder holder = null; if (convertView == null)
{ holder = new ViewHolder (); convertView = myInflater.inflate (R.layout.list_view_row, null); holder.message = (Textview) convertView.findViewById (R.id.message);
......
convertView.setTag (holder);

}
else
{ holder = (ViewHolder) convertView.getTag (); }
LinearLayout.LayoutParams ivparams = (android.widget.LinearLayout.LayoutParams) holder.message.getLayoutParams () ;/ / error line, reported a null pointer, because the holder the things inside are empty
......

return convertView; }

------ Solution ----------------------------------- ---------
GroupListView not solve your needs it?
------ For reference only ------------------ ---------------------
Thank you, then indeed changed ExpandableList the

没有评论:

发表评论