本文整理匯總了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);
}