本文整理汇总了Java中android.app.ListFragment.setListAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java ListFragment.setListAdapter方法的具体用法?Java ListFragment.setListAdapter怎么用?Java ListFragment.setListAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ListFragment
的用法示例。
在下文中一共展示了ListFragment.setListAdapter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onFragmentViewCreated
import android.app.ListFragment; //导入方法依赖的package包/类
@Override
public void onFragmentViewCreated(ListFragment fragment) {
fragment.getListView().addHeaderView(
getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
if (dayIndex < 0) {
fragment.setListAdapter(mDayZeroAdapter);
fragment.getListView().setRecyclerListener(mDayZeroAdapter);
} else {
fragment.setListAdapter(mScheduleAdapters[dayIndex]);
fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
}
示例2: onFragmentViewCreated
import android.app.ListFragment; //导入方法依赖的package包/类
@Override
public void onFragmentViewCreated(ListFragment fragment) {
fragment.getListView().addHeaderView(
getLayoutInflater().inflate(com.saarang.samples.apps.iosched.R.layout.reserve_action_bar_space_header_view, null));
int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
fragment.setListAdapter(mScheduleAdapters[dayIndex]);
fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
示例3: onFragmentViewCreated
import android.app.ListFragment; //导入方法依赖的package包/类
@Override
public void onFragmentViewCreated(ListFragment fragment) {
fragment.getListView().addHeaderView(
getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
fragment.setListAdapter(mScheduleAdapters[dayIndex]);
fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
示例4: onCreate
import android.app.ListFragment; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rest_service);
mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ListFragment list = new ListFragment();
ft.add(R.id.fragment_content, list);
// Let's set our list adapter to a simple ArrayAdapter.
list.setListAdapter(mAdapter);
// RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
// we need to check if our FragmentManager is already storing an instance of the responder.
TwitterSearchResponderFragment responder =
(TwitterSearchResponderFragment) fm.findFragmentByTag("RESTResponder");
if (responder == null) {
responder = new TwitterSearchResponderFragment();
// We add the fragment using a Tag since it has no views. It will make the Twitter REST call
// for us each time this Activity is created.
ft.add(responder, "RESTResponder");
}
// Make sure you commit the FragmentTransaction or your fragments
// won't get added to your FragmentManager. Forgetting to call ft.commit()
// is a really common mistake when starting out with Fragments.
ft.commit();
}
示例5: onCreate
import android.app.ListFragment; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rest_service);
mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ListFragment list = new ListFragment();
ft.add(R.id.fragment_content, list);
list.setListAdapter(mAdapter);
// RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
// we need to check if our FragmentManager is already storing an instance of the responder.
GaspReviewsResponderFragment responder =
(GaspReviewsResponderFragment) fm.findFragmentByTag("RESTResponder");
if (responder == null) {
responder = new GaspReviewsResponderFragment();
// We add the fragment using a Tag since it has no views. It will make the Twitter REST call
// for us each time this Activity is created.
ft.add(responder, "RESTResponder");
}
ft.commit();
}