Expandable ListView를 보유하고있는 내 프래그먼트에서 한 줄의 코드에 문제가있는 것 같습니다. 이 작업은 하나의 액티비티에 하나의 http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/을 만드는 방법에 대한 자습서를 따랐습니다. 나는 이것을 하나의 활동 내에서 다른 작업 공간에서 올바르게 작동하게했다.Contractor ExpandableListAdapter ...가 정의되지 않았습니다.
이제 조각 내에서 동일한 코드를 구현하려고합니다. 나는 하루 동안 하나의 실수 만 남았습니다. 아래는 확장 가능한 ListView 코드의 첫 번째 비트입니다.
SuikodenFragment.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ExpandableListView;
public class SuikodenFragment extends Fragment {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.suikoden_main_activity1, container, false);
// you can use findViewById() using the above 'view'
// get the listview
expListView = (ExpandableListView) rootView.findViewById(R.id.suikodenList1);
// preparing list data
prepareListData();
listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
return rootView;
}
오류입니다 - 생성자 ExpandableListAdapter (SuikodenFragment, 목록의 HashMap>) 이 라인에
정의되지 않은 -
listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
예를 :
대신, 다음 사용! 정말 감사합니다! 그것은 일했다! – theCreed