我有通過Facebook中的Json解析獲取評論,我創建了擴展列表視圖以查看帖子的所有評論,但它無法在佈局中擴展。請幫我解決這個問題。 這是我的XML佈局ExpandedList視圖在Android中不能正常工作
<ExpandableListView
android:id="@+id/expandableListView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:groupIndicator="@null">
</ExpandableListView>
而且我的代碼
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
int s=ConstantsValues.commentsResponse.get(position).size();
View view=convertView;
LayoutInflater inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view=inflater.inflate(R.layout.custom_expandablecomments_parentgroup, parent,false);
TextView tv1=(TextView)view.findViewById(R.id.textView_GROUP);
tv1.setText("Click hee to see " +s+" comments");
tv1.setPadding(100, 0, 0,0);
return view;
}
public View getChildView(int groupPosition, int childPosition,boolean isLastChild, View convertView, ViewGroup parent) {
HashMap<String, Object> hashmap= ConstantsValues.commentsResponse.get(groupPosition).get(childPosition);
View view=convertView;
position=childPosition;
LayoutInflater inflater =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view=inflater.inflate(R.layout.custom_expandable_comments, parent,false);
ImageView imv=(ImageView)view.findViewById(R.id.Imageview_profipic_commentsShow);
TextView tv1=(TextView)view.findViewById(R.id.textView_Name_CommentShow);
TextView tv2=(TextView)view.findViewById(R.id.textView_Comments_show);
imv.setImageBitmap((Bitmap)hashmap.get("Image"));
tv1.setText((String)hashmap.get("UserName"));
tv2.setText((String)hashmap.get("CommentsFull"));
return view;
}
發生了什麼事..What的問題 – Pragnani 2013-04-09 12:09:34
@Pragnani整個評論即時取不其展開。 – 2013-04-09 12:24:28
檢查是否有任何異常或在logcat ..如果發佈的錯誤.. – Pragnani 2013-04-09 12:26:04