0

getView メソッドで作成したカスタム リストがあり、そのカスタム リストの各行に別のカスタム リストビューを配置したいと考えています。次のようになります。

  • 行1
  • リスト
  • テキスト1 テキスト2
  • テキスト1 テキスト2
  • テキスト1 テキスト2

  • 行 2
  • リスト
  • テキスト1 テキスト2
  • テキスト1 テキスト2
  • テキスト1 テキスト2

  • 行 3
  • リスト
  • テキスト1 テキスト2
  • テキスト1 テキスト2
  • テキスト1 テキスト2

しかし、別の getview メソッドをメインの getView に追加できないようです。誰か提案はありますか?ありがとう

編集:

public static class ChildAdapter extends BaseAdapter {
     private LayoutInflater mInflater;       
     public IrrigationAdapter(Context context) {
               mInflater = LayoutInflater.from(context);
                }
    public int getCount() {
                return array.size();
                }
     public Object getItem(int position) {
                    return position;
                }
     public long getItemId(int position) {
                    return position;
                }       
     public View getView(final int position, View convertView, ViewGroup parent) {
            final ViewHolder holder;
                if (convertView == null) {
                    convertView = mInflater.inflate(R.layout.table_row1, null);
                    holder = new ViewHolder();
                    holder.Text1 = (TextView) convertView.findViewById(R.id.TextView01);
                            holder.Text2 = (TextView) convertView.findViewById(R.id.TextView02);
                    convertView.setTag(holder);                         
                } else {
                    holder = (ViewHolder) convertView.getTag();
                }   
               holder.Text1.setText(sulamaDonemArr.get(position));
                   holder.Text2.setText(bitkiDesenArr.get(position));

       return convertView;
       }    

         static class ViewHolder {      
              TextView Text1;
              TextView Text2;                
            }               
        }

private static class MainAdapter extends BaseAdapter {
     private LayoutInflater mInflater;
     public SulamaDetayAdapter(Context context) {
               mInflater = LayoutInflater.from(context);                   
                }
     public int getCount() {
                return arraysize;
                }
     public Object getItem(int position) {
                    return position;
                }
     public long getItemId(int position) {
                    return position;
                }       
     public View getView(final int position, View convertView, ViewGroup parent) {
            final ViewHolder holder;                
                if (convertView == null) {
                    convertView = mInflater.inflate(R.layout.table_row_sulamabaslama_detay, null);
                    holder = new ViewHolder();
                    holder.text1= (TextView)convertView.findViewById(R.id.txt);
                    holder.childAdapterList.setAdapter(????);


                    convertView.setTag(holder);                                         
                } else {
                    holder = (ViewHolder) convertView.getTag();
                }                       

       return convertView;
       }

         static class ViewHolder {      
              TextView text1,text2;               
              ListView childAdapterList;
            }       

}

今はこんな感じです

4

2 に答える 2

0

各行で展開可能なリスト ビューを使用できます。あなたが望むように実行できるように。

于 2013-02-11T12:41:04.693 に答える
0

私が質問を正しく理解していれば、あなたはExpandableListViewを探しています

于 2013-02-11T12:41:54.677 に答える