本文整理匯總了Java中android.app.ListFragment.setListAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java ListFragment.setListAdapter方法的具體用法?Java ListFragment.setListAdapter怎麽用?Java ListFragment.setListAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.app.ListFragment
的用法示例。
在下文中一共展示了ListFragment.setListAdapter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
示例2: 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]);
}
}
示例3: 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]);
}
示例4: 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]);
}
示例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();
}