當前位置: 首頁>>代碼示例>>Java>>正文


Java RecyclerView.setItemAnimator方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.setItemAnimator方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.setItemAnimator方法的具體用法?Java RecyclerView.setItemAnimator怎麽用?Java RecyclerView.setItemAnimator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.setItemAnimator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void init() {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.episodelist_layout, this, true);

    mChildrenView = (RecyclerView) findViewById(R.id.episodes);
    mParentView = (RecyclerView) findViewById(R.id.groups);

    mEpisodesLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);
    mGroupLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);

    mChildrenView.setLayoutManager(mEpisodesLayoutManager);
    mParentView.setLayoutManager(mGroupLayoutManager);

    mChildrenView.setItemAnimator(new DefaultItemAnimator());
    mParentView.setItemAnimator(new DefaultItemAnimator());

    mChildrenView.setOnFocusChangeListener(this);
    mParentView.setOnFocusChangeListener(this);
    this.setOnFocusChangeListener(this);
}
 
開發者ID:hejunlin2013,項目名稱:EpisodeListView,代碼行數:21,代碼來源:EpisodeListView.java

示例2: init

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void init() {
    Collections.sort(scheduleList, new Comparator<Schedule>() {
        @Override
        public int compare(Schedule o1, Schedule o2) {
            return (o1.getTime().compareTo(o2.getTime()));
        }
    });

    scheduleRecyclerView = (RecyclerView)
            customView.findViewById(R.id.shedule_recyclerview);
    scheduleAdapter = new ScheduleAdapter(getContext(), scheduleList);
    scheduleRecyclerView.setAdapter(scheduleAdapter);
    LinearLayoutManager layoutManager =
            new LinearLayoutManager(getContext());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    scheduleRecyclerView.setLayoutManager(layoutManager);
    scheduleRecyclerView.setItemAnimator(new DefaultItemAnimator());
    scheduleRecyclerView.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.INVISIBLE);
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:21,代碼來源:SliderScheduleFragment.java

示例3: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View mRootView = inflater.inflate(R.layout.fragment_map,container,false);
    hotels = new ArrayList<>();


    SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map_item);
    mapFragment.getMapAsync(this);

     recyclerView = (RecyclerView) mRootView.findViewById(R.id.map_recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(LinearLayout.HORIZONTAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    mAdapter = new CardViewAdapter(hotels);
    mAdapter.setActionListner(this);
    recyclerView.setAdapter(mAdapter);

    if (mPresenter != null)
        mPresenter.loadHotels();


    return mRootView;
}
 
開發者ID:Elbehiry,項目名稱:Viajes,代碼行數:27,代碼來源:MapFragment.java

示例4: initializeFormBuildHelper

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * private method for initializing form build helper
 * @param context
 * @param recyclerView
 * @param listener
 */
private void initializeFormBuildHelper(Context context, RecyclerView recyclerView, OnFormElementValueChangedListener listener) {

    // initialize form adapter
    this.mFormAdapter = new FormAdapter(context, listener);

    // set up the recyclerview with adapter
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    linearLayoutManager.setStackFromEnd(false);

    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(mFormAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());

}
 
開發者ID:adib2149,項目名稱:FormMaster,代碼行數:22,代碼來源:FormBuilder.java

示例5: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater,
    ViewGroup container, Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.quran_list, container, false);

  final Context context = getActivity();
  mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
  mRecyclerView.setHasFixedSize(true);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
  mRecyclerView.setItemAnimator(new DefaultItemAnimator());

  final QuranListAdapter adapter =
      new QuranListAdapter(context, mRecyclerView, getJuz2List(), false);
  mRecyclerView.setAdapter(adapter);
  return view;
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:17,代碼來源:JuzListFragment.java

示例6: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    mBadgeViewAdapter = new BadgeViewAdapter(mBadgeList, getContext());

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_badge_view, container, false);

    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.badge_recyclerView);
    mProgressBar = (ProgressBar) view.findViewById(R.id.loading_badges);

    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), LinearLayoutManager.VERTICAL);
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setAdapter(mBadgeViewAdapter);

    return view;
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:23,代碼來源:BadgeViewFragment.java

示例7: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_queue, container, false);

    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.playing_queue);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(null);

    new loadQueueSongs().execute("");
    ((BaseActivity) getActivity()).setMusicStateListenerListener(this);

    return rootView;
}
 
開發者ID:Vinetos,項目名稱:Hello-Music-droid,代碼行數:23,代碼來源:QueueFragment.java

示例8: initView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initView(Context context) {
    mContext = context;
    View view = LayoutInflater.from(context).inflate(com.wuxiaolong.pullloadmorerecyclerview.R.layout.pull_loadmore_layout, null);
    mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(com.wuxiaolong.pullloadmorerecyclerview.R.id.swipeRefreshLayout);
    mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_green_dark, android.R.color.holo_blue_dark, android.R.color.holo_orange_dark);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayoutOnRefresh(this));

    mRecyclerView = (RecyclerView) view.findViewById(com.wuxiaolong.pullloadmorerecyclerview.R.id.recycler_view);
    mRecyclerView.setVerticalScrollBarEnabled(true);

    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addOnScrollListener(new RecyclerViewOnScroll(this));

    mRecyclerView.setOnTouchListener(new onTouchRecyclerView());

    mFooterView = view.findViewById(R.id.footerView);

    loadMoreLayout = (LinearLayout) view.findViewById(R.id.loadMoreLayout);
    loadMoreText = (TextView) view.findViewById(R.id.loadMoreText);

    mFooterView.setVisibility(View.GONE);

    this.addView(view);

}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:PullLoadMoreRecyclerView.java

示例9: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    mAchievementAdapter = new AchievementViewAdapter(mAchievementList, mAchievementsFragment);

    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_achievement_view, container, false);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.achievement_recyclerView);

    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(recyclerView.getContext(), LinearLayoutManager.VERTICAL);
    recyclerView.addItemDecoration(dividerItemDecoration);
    recyclerView.setAdapter(mAchievementAdapter);

    return view;
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:21,代碼來源:AchievementViewFragment.java

示例10: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_event_content);
    recyclerView= (RecyclerView) findViewById(R.id.recycler_view);
    list=new ArrayList<>();
    adapter=new EventAdapter(this,list);
    toolbar= (Toolbar) findViewById(R.id.Event_toolbar);
    toolbar.setNavigationIcon(R.drawable.backbutton);
    toolbar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    RecyclerView.LayoutManager layoutManager=new GridLayoutManager(this,2);  // 2 is the number of columns in grid view
    recyclerView.setLayoutManager(new GridLayoutManager(this,2));
    recyclerView.addItemDecoration(new GridSpacingItemDecoration(2,dpToPx(10),true));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
    initialize();

}
 
開發者ID:rishabh115,項目名稱:Odyssey2017,代碼行數:24,代碼來源:EventActivity.java

示例11: onViewCreated

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    adapter = new PlayerAdapter(activity, this, items);
    listView = (RecyclerView) view.findViewById(android.R.id.list);
    listView.setLayoutManager(new LinearLayoutManager(getActivity()));
    listView.setItemAnimator(new DefaultItemAnimator());

    listView.setAdapter(adapter);

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Now playing");
    t.send(new HitBuilders.AppViewBuilder().build());
}
 
開發者ID:dmllr,項目名稱:IdealMedia,代碼行數:16,代碼來源:PlayerFragment.java

示例12: configRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * 配置 RecyclerView
 *
 * @param recyclerView
 * @param layoutManager
 */
public static void configRecyclerView(final RecyclerView recyclerView
        , RecyclerView.LayoutManager layoutManager) {
    recyclerView.setLayoutManager(layoutManager);
    //如果可以確定每個item的高度是固定的,設置這個選項可以提高性能
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
開發者ID:Zweihui,項目名稱:Aurora,代碼行數:14,代碼來源:ArmsUtils.java

示例13: setupListView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void setupListView(View view){
    RecyclerView rv = view.findViewById(R.id.rv_wallet);
    rv.setLayoutManager(new LinearLayoutManager(getActivity()));
    rv.setItemAnimator(new DefaultItemAnimator());

    rv.addItemDecoration( new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));

    mAdapter = new WalletListAdapter();
    mAdapter.setCallback( this );
    rv.setAdapter( mAdapter );

    mWalletRV = rv;
}
 
開發者ID:mithrilcoin-io,項目名稱:EosCommander,代碼行數:14,代碼來源:WalletFragment.java

示例14: configRecycleView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * 配置recycleview
 *
 * @param recyclerView
 * @param layoutManager
 */
public static void configRecycleView(final RecyclerView recyclerView
        , RecyclerView.LayoutManager layoutManager) {
    recyclerView.setLayoutManager(layoutManager);
    //如果可以確定每個item的高度是固定的,設置這個選項可以提高性能
    recyclerView.setHasFixedSize(true);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
開發者ID:hshare,項目名稱:MVPArmsTest1,代碼行數:14,代碼來源:UiUtils.java

示例15: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recycler_gallery_layout);
    top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
    btn_add=(Button)this.findViewById(R.id.btn_add);
    btn_delete=(Button)this.findViewById(R.id.btn_delete);
    top_bar_linear_back.setOnClickListener(new CustomOnClickListener());
    btn_add.setOnClickListener(new CustomOnClickListener());
    btn_delete.setOnClickListener(new CustomOnClickListener());
    top_bar_title=(TextView)this.findViewById(R.id.top_bar_title);
    top_bar_title.setText("RecyclerView打造Gallery效果");
    //初始化RecyclerView控件
    gallery_recycler=(RecyclerView)this.findViewById(R.id.gallery_recycler);
    //固定高度
    gallery_recycler.setHasFixedSize(true);
    //創建布局管理器
    LinearLayoutManager linearLayoutManager=new CustomLinearLayoutManager(this);
    //設置橫向
    linearLayoutManager.setOrientation(OrientationHelper.HORIZONTAL);
    //設置布局管理器
    gallery_recycler.setLayoutManager(linearLayoutManager);
    //設置分割線
    gallery_recycler.addItemDecoration(new TestDecoration(this));
    //設置動畫
    gallery_recycler.setItemAnimator(new DefaultItemAnimator());
    //創建適配器
    adapter=new GalleryRecyclerAdapter(this);
    //綁定適配器
    gallery_recycler.setAdapter(adapter);
    adapter.setOnRecyclerViewItemClickListener(new GalleryRecyclerAdapter.OnRecyclerViewItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Toast.makeText(RecyclerGalleryActivity.this,"您點擊的Item的索引為:"+position,Toast.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:38,代碼來源:RecyclerGalleryActivity.java


注:本文中的android.support.v7.widget.RecyclerView.setItemAnimator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。