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


Java RecyclerView.getItemAnimator方法代碼示例

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


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

示例1: initView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }
    mCoordinatorLayout = findViewById(R.id.coordinator);

    RecyclerView recyclerView = findViewById(R.id.recycle_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof DefaultItemAnimator) {
        ((DefaultItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    mAdapter = new CancelAdapter(this, new ArrayList<DayLesson>());
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
    recyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(recyclerView);

    mView_FABMenu = findViewById(R.id.fab_menu_1);
    mView_FABMenu.setVisibility(View.GONE);
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:26,代碼來源:CancelListActivity.java

示例2: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // 實例化控件
    final RecyclerView rv = (RecyclerView) findViewById(R.id.rv);

    // 設置啟動列表的修改動畫效果(默認為關閉狀態) 23.0.1以後使用方法,23.0.1之前用setSupportsChangeAnimations方法
    RecyclerView.ItemAnimator animator = rv.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    // 設置動畫時長
    rv.getItemAnimator().setChangeDuration(300);
    rv.getItemAnimator().setMoveDuration(300);

    // 實現RecyclerView實現豎向列表展示模式
    final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    rv.setLayoutManager(layoutManager);

    // 實例化數據適配器並綁定在控件上
    final MainAdapter adapter = new MainAdapter();
    rv.setAdapter(adapter);
}
 
開發者ID:AndroidKiven,項目名稱:RecyclerviewExpand,代碼行數:25,代碼來源:MainActivity.java

示例3: initView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void initView() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(mContext, R.color.color_Actionbar)));
    }
    mCoordinatorLayout = findViewById(R.id.coordinator);

    RecyclerView recyclerView = findViewById(R.id.recycle_view);
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof DefaultItemAnimator) {
        ((DefaultItemAnimator) animator).setSupportsChangeAnimations(false);
    }
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new SubjectAdapter(this, new ArrayList<Subject>());
    @SuppressWarnings("unchecked") SwingBottomInAnimationAdapter animatorAdapter = new SwingBottomInAnimationAdapter(mAdapter, recyclerView);
    recyclerView.setAdapter(animatorAdapter);

    ItemTouchHelper.Callback callback = new ItemTouchHelperCallBackNoMove(mAdapter);
    ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
    touchHelper.attachToRecyclerView(recyclerView);

    mView_FABMenu = findViewById(R.id.fab_menu_1);
    FloatingActionButton addSubject = findViewById(R.id.fab_action_1);
    addSubject.setVisibility(View.VISIBLE);
    addSubject.setLabelText(mContext.getResources().getString(R.string.add_subject));
    addSubject.setOnClickListener(this);
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:29,代碼來源:SubjectListActivity.java

示例4: changeItemAnimation

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public static void changeItemAnimation(RecyclerView recyclerView, boolean isOpen) {
    // 關閉viewholder動畫效果。解決viewholder閃爍問題
    RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator();
    if (animator instanceof SimpleItemAnimator) {
        ((SimpleItemAnimator) animator).setSupportsChangeAnimations(isOpen);
    }
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:8,代碼來源:RecyclerViewUtil.java

示例5: getAnimationDuration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public long getAnimationDuration(RecyclerView recyclerView, int animationType, float animateDx, float animateDy) {
    ItemAnimator itemAnimator = recyclerView.getItemAnimator();
    return itemAnimator == null ? animationType == 8 ? 200 : 250 : animationType == 8 ? itemAnimator.getMoveDuration() : itemAnimator.getRemoveDuration();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:5,代碼來源:ItemTouchHelper.java


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