コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.base_listview_fragment, container, false);
    refreshLayout = (PullToRefreshViewBase) rootView.findViewById(R.id.refreshLayout);
    progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
    listView = (ExtendableListView) rootView.findViewById(R.id.listView);
    emptyView = (TextView) rootView.findViewById(R.id.emptyView);

    listView.setEmptyView(emptyView);
    refreshLayout.setSwipeableChildren(R.id.listView, R.id.emptyView);
    refreshLayout.setRefreshListview(listView);
    refreshLayout.setOnPullRefreshListener(this);

    if (Build.VERSION.SDK_INT < 21) {
      listView.setSelector(R.drawable.touch_feedback_holo_light);
    }

    return rootView;
  }