2011-08-16 2 views
1

にListViewコントロールにsimpleExpandableListAdapterまたは類似のものを適用することができ、私はListFragmentと協力し、困難なリストを作りたい、サブリストを持っていると私はそれを行うことができます方法がわからないのです(( いくつかのコード:どのように私はListFragment

public class CarsOfBrandFragment extends ListFragment { 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     ... 
     String[] s = {"colorName"}; 
     int[] k = {R.id.groupname}; 
     String[] s1 = new String[]{"shadeName", "rgb"}; 
     int[] k1 = new int[]{R.id.childname, R.id.rgb}; 
     SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter(getActivity(), createGroupList(), 
      R.layout.grouprow, s, k, createChildList(), R.layout.childrow, s1, k1); 
     setListAdapter(expListAdapter); 
    } 

android.support.v4.app.ListFragmentでsetListAdapter(android.widget.ListAdapter)は(android.widget.SimpleExpandableListAdapter)に適用することはできません

+0

を使用して、私はここにhttp://stackoverflow.com/questions/6051050/見てみアドバイスう互換性パッケージのloadermanagerを使用したexpandablelistfragment – Necronet

+0

http://code.google.com/p/android/issues/detail?id=20973のために機能要求を提出しました。 –

+0

私は何か同様のことをやっています。ここでは、コンパイルエラー、いいえ、コンパイルエラーは、stackoverflow.com/questions/10611927/simplecursortreeadapter-and-cursorloader#comment13750623_10611927 – toobsco42

答えて

1

私はExapndableListViewを示す明示することでこれを決めた - はい、私は拡張可能で通常のリストビューを変更し、SimpleCursorTreeAdapter代わりのSimpleExpandableListAdapter

+3

あなたが私たちにコードを示したらそれは役に立ちます! –

1

は、あなただけのListView自体にそれを設定することができませんか?

ListView lv = (ListView) findViewById(R.id.your_list); 
lv.setAdapter(expListAdapter); 
[OK]を
+0

いいえ。明らかに、このアダプタはListViewと互換性がありません。多分別の方法がありますか? – LackOfKnowledge

+0

エラーは何ですか? – roundhill

+1

私は上に書いています:android.support.v4.app.ListFragmentのsetListAdapter(android.widget.ListAdapter)は(android.widget.SimpleExpandableListAdapter)に適用できません – LackOfKnowledge