2011-01-21 3 views
1

私はSimpleExpandableListAdapterを実装しました。セクションタイトルをカスタマイズしようとしています。これを行うには、私はgroupToパラメータにconstructorにカスタムTextViewのIDを渡す:SimpleExpandableListAdapterセクションのタイトル

setListAdapter(new SimpleExpandableListAdapter(this, 
                groupsData, 
                android.R.layout.simple_expandable_list_item_1, 
                new String[]{SECTION}, 
                new int[]{R.id.list_group_title}, 
                innerData, 
                0, 
                null, 
                new int[]{}){ /*my code here*/ }); 

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/list_group_title" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textSize="20dip" /> 

問題は、何も現れていませんさ!あたかもビューがなかったかのように、全体が空白になります。 なぜ、または私はこれを解決するために読むことができる任意のアイデア?ありがとう!

答えて

0
MyAdapter ma = new MyAdapter(this,groupsData,android.R.layout.simple_expandable_list_item_1,new String[]{SECTION}, new int[]{R.layout.list_group_title},innerData,0,null,new int[]{}); 
    setListAdapter(ma); 


    private static class MyAdapter extends SimpleExpandableListAdapter 
    { 
      LayoutInflater layoutInflater; 
      int title; 

      public MyAdapter(Context context,List<? extends Map<String, ?>> groupData,int groupLayout,String[ ] groupFrom,int[ ] groupTo,List<? extends List<? extends Map<String, ?>>> childData,int childLayout,String[ ] childFrom, int[ ] childTo) 
      {   
       super(context,groupData,groupLayout,groupFrom,groupTo,childData,childLayout,childFrom,childTo); 
       title = groupTo[0]; 
       layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      } 
      @Override 
      public View getGroupView(int groupPosition,boolean isExpanded,View convertView,ViewGroup parent) 
      { 
       return (TextView)layoutInflater.inflate(title,null); 
      } 
    } 

getGroupViewで膨らませます。それでも、なぜそれが自動的にsuperコンストラクタに渡されないのか分かりません。

関連する問題