本文整理汇总了Java中android.view.ViewGroup.setLayoutAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.setLayoutAnimation方法的具体用法?Java ViewGroup.setLayoutAnimation怎么用?Java ViewGroup.setLayoutAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.setLayoutAnimation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.view.ViewGroup; //导入方法依赖的package包/类
@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();
}
示例2: onCreate
import android.view.ViewGroup; //导入方法依赖的package包/类
@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();
}
示例3: applyLayoutAnimation
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* 应用一个布局动画
*/
public static void applyLayoutAnimation(final ViewGroup viewGroup, final Animation animation) {
if (animation == null) {
viewGroup.setLayoutAnimation(null);
return;
}
final LayoutAnimationController layoutAnimationController = new LayoutAnimationController(animation);
viewGroup.setLayoutAnimation(layoutAnimationController);
}
示例4: setLayoutAnimation
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* 根据指定的动画、单个子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);
}