1

Github の ViewFlow ライブラリを使用しています。ViewFlow

このライブラリを使用して 4 つのスワイプ画面を表示しています。これらの画面にはリストビューがあります。このリストのデータは、ユーザーがボタンを押すと変更されます。私の問題は、リストをスクロールするか、数回タッチする必要があり、リストだけが更新されることです。Viewflow を使用しているため、他に何かしなければならないことはありますか?

私のメインアクティビティの関連コードは以下の通りです:

    setContentView(R.layout.slidingpan);
    ViewFlow viewFlow = (ViewFlow) findViewById(R.id.viewflow);

    viewFlow.setAdapter(new screenAdapter(this));
    CircleFlowIndicator indic = (CircleFlowIndicator) findViewById(R.id.viewflowindic);
    viewFlow.setFlowIndicator(indic);

ScreenAdapter コードは次のとおりです。

public class screenAdapter extends BaseAdapter {

private LayoutInflater mInflater;
public static Context here;


private static final int[] ids = { R.layout.multiple_screen_1, 
  R.layout.layout_vol_opportunity, R.layout.multiple_screen_3,
                                R.layout.multiple_screen_4};

public screenAdapter(Context context) 
{
    this.here = context;
    mInflater = (LayoutInflater) 
    context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

@Override
public int getCount() {
    return ids.length;
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.activity_main_page, null);
    }
    convertView = mInflater.inflate(ids[position], null);

    switch(ids[position])
    {
        case R.layout.multiple_screen_1:
            break;

        case R.layout.tabs_layout:      //volunteering opportunities

            break;

        case R.layout.multiple_screen_3:

            break;

        case R.layout.multiple_screen_4:
            break;
    }
    return convertView;
}
}

次のスニペットは、リストを更新する方法を示しています。

        projects.clear();

        boolean exit ;
        for (int i = 0 ; i < tempList.length; i++)
        {
            exit = false;
            ArrayList<Category> temp = filterList.get(i);   
            for(int j=0;j < temp.size();j++)    
            {
                for(int k = 0; k < filter.size();k++)   
                {
                    if(filter.get(k).equals(temp.get(j)))       
                    {
                        projects.add(tempList[i]);
                        exit = true;
                        break;
                    }
                }
                if(exit==true)
                    break;
            }
        }

        handle.post(new Runnable() {
            @Override
            public void run() {
                expListAdapter.notifyDataSetChanged();
            }
        });

expandiblelistview でも同じ問題が発生していました。少しスクロールしないと拡大しませんでした。

4

0 に答える 0