Activity안에 viewpager로 fragment1, fragment2로 구성되어있습니다.
fragment1안에 expandablelistview 가 있고요
fragment2안에 listview 가 있고, 둘다 custom하였습니다..
그런데 expandablelistview 만 클릭이 안되네요...
문제가 무엇인지 도무지 모르겠습니다.. 도와주세요 .. 소스코드 첨부합니다..
custom_expandable_listview_adapter.java
public class CustomAdapterExpandableListView extends BaseExpandableListAdapter {
private LayoutInflater inflater;
private ArrayList<GroupData> groupDatas;
private ArrayList<ArrayList<ChildData>> childDatas;
private Context context_;
private int ParentClickStatus = -1;
private int ChildClickStatus = -1;
private Bitmap bitmap;
public CustomAdapterExpandableListView(Context c, ArrayList<GroupData> groupDatas, ArrayList<ArrayList<ChildData>> childDatas) {
context_ = c;
this.groupDatas = groupDatas;
this.childDatas = childDatas;
inflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return groupDatas.get(groupPosition).child.get(childPosition); // childDatas.get(groupPosition).get(childPosition);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}//0
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parentView) {
convertView = inflater.inflate(R.layout.expandable_listview_child_navi_2, parentView, false);
TextView mission = (TextView) convertView.findViewById(R.id.name_text_view);
mission.setText(childDatas.get(groupPosition).get(childPosition).getMission_info());
return convertView;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parentView) {
final GroupData parent = groupDatas.get(groupPosition);
// Inflate grouprow.xml file for parent rows
convertView = inflater.inflate(R.layout.expandable_listview_group_navi_1, parentView, false);
bitmap = BitmapFactory.decodeResource(convertView.getResources(), R.drawable.icon_etc);
bitmap = Bitmap.createScaledBitmap(bitmap, 25, 27, true);
// Get grouprow.xml file elements and set values
((TextView) convertView.findViewById(R.id.group_name)).setText(parent.getRoom_Title());
((ImageView) convertView.findViewById(R.id.icon)).setImageBitmap(bitmap);
((TextView) convertView.findViewById(R.id.missons)).setText("미션 " + parent.getHow_Many_Missons() + "개 보기");
return convertView;
}
@Override
public int getChildrenCount(int groupPosition) {
/* if(childDatas.get(groupPosition).size() == 0)
{
return 0;
}*/
return childDatas.get(groupPosition).size();
}
@Override
public GroupData getGroup(int groupPosition) {
return groupDatas.get(groupPosition);
}
@Override
public int getGroupCount() {
return groupDatas.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
@Override
public boolean hasStableIds() {
return false;//true
}
@Override
public boolean areAllItemsEnabled() {
return super.areAllItemsEnabled();
} //true
}
fragment1.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/header_height" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="9dp"
android:background="#5268c1"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView2"
android:layout_width="18dp"
android:layout_height="9dp"
android:layout_marginLeft="75dp"
android:background="@drawable/arrow_02" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="19"
android:background="#5268c1"></RelativeLayout>
<LinearLayout
android:id="@+id/layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="360"
android:background="#5268c1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="41dp"
android:background="@drawable/navi_shape"></RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mylist">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f0f0"
android:divider="@drawable/dot_line"
android:groupIndicator="@android:color/transparent"
android:dividerHeight="2dp"
tools:listitem="@android:layout/simple_expandable_list_item_1" /></LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="19"
android:background="#5268c1"></RelativeLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>