Java Code Examples for android.view.ViewGroup#setLayoutAnimation()

The following examples show how to use android.view.ViewGroup#setLayoutAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaggeredGridActivity.java    From RecyclerViewAnimation with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_grid);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mRecyclerView = (StaggeredGridRecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
    mStaggeredGridAdapter = new StaggeredGridAdapter();
    mStaggeredGridAdapter.setDataSet(mockData());
    mRecyclerView.setAdapter(mStaggeredGridAdapter);
    LayoutAnimationController controller = MyLayoutAnimationHelper.makeLayoutAnimationController();
    ViewGroup viewGroup = (ViewGroup) findViewById(R.id.root_view);
    viewGroup.setLayoutAnimation(controller);
    viewGroup.scheduleLayoutAnimation();
}
 
Example 2
Source File: RecyclerViewActivity.java    From RecyclerViewAnimation with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(new DemoRecyclerViewAdapter());
    LayoutAnimationController controller = MyLayoutAnimationHelper.makeLayoutAnimationController();
    ViewGroup viewGroup = (ViewGroup) findViewById(R.id.root_view);
    viewGroup.setLayoutAnimation(controller);
    viewGroup.scheduleLayoutAnimation();
}
 
Example 3
Source File: DynamicDetailFragment.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void a(ViewGroup viewgroup, ViewGroup viewgroup1)
{
    viewgroup.setVisibility(4);
    viewgroup1.setVisibility(0);
    AnimationSet animationset = new AnimationSet(true);
    AlphaAnimation alphaanimation = new AlphaAnimation(0.0F, 1.0F);
    alphaanimation.setDuration(80L);
    animationset.addAnimation(alphaanimation);
    TranslateAnimation translateanimation = new TranslateAnimation(1, 0.0F, 1, 0.0F, 1, -1F, 1, 0.0F);
    translateanimation.setDuration(100L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    animationset.addAnimation(translateanimation);
    viewgroup1.setLayoutAnimation(new LayoutAnimationController(animationset, 0.7F));
    viewgroup1.requestLayout();
}
 
Example 4
Source File: ILayoutAnimationController.java    From ILayoutAnimationController with Apache License 2.0 2 votes vote down vote up
/**
 * 根据指定的动画、单个子View动画延时、子View动画执行顺序算法枚举值 创建一个新的CustomLayoutAnimationController实例,
 * 将此实例作为参数为viewGroup设置布局动画
 * @param viewGroup
 * @param animation
 * @param delay
 * @param indexAlgorithm
 */
public static void setLayoutAnimation(@NonNull ViewGroup viewGroup, @NonNull Animation animation, float delay, @Nullable final IndexAlgorithm indexAlgorithm){
    ILayoutAnimationController controller = generateController(animation,delay,indexAlgorithm);
    viewGroup.setLayoutAnimation(controller);
}