类android.view.animation.LayoutAnimationController源码实例Demo

下面列出了怎么用android.view.animation.LayoutAnimationController的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: homeassist   文件: EntityFragment.java
private void refreshPreferenceConfigs() {
    Activity activity = getActivity();
    if (activity != null && !activity.isFinishing()) {
        Display display = getActivity().getWindowManager().getDefaultDisplay();
        DisplayMetrics outMetrics = new DisplayMetrics();
        display.getMetrics(outMetrics);

        float density = getResources().getDisplayMetrics().density;
        //float dpHeight = outMetrics.heightPixels / density;
        float dpWidth = outMetrics.widthPixels / density;

        //final int spanCount = getResources().getInteger(R.integer.grid_columns);
        int spanCount = (int) Math.floor(dpWidth / 90.0d);
        final int prefCount = Integer.parseInt(mSharedPref.getString("num_columns", "0"));
        if (prefCount != 0) {
            spanCount = prefCount;
        }

        mRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), spanCount));

        int resId = R.anim.grid_anim;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId);
        mRecyclerView.setLayoutAnimation(animation);
    }
}
 
源代码2 项目: Deadline   文件: EventsFragment.java
private void setupEventList() {
    RecyclerView recyclerView = mBinding.listEvents;
    mEventsAdapter = new EventsAdapter(getContext(), mViewModel);

    recyclerView.setAdapter(mEventsAdapter);

    ItemTouchHelper touchHelper = new ItemTouchHelper(new EventTouchHelperCallback(mEventsAdapter));
    touchHelper.attachToRecyclerView(recyclerView);

    LayoutAnimationController animationController = AnimationUtils.loadLayoutAnimation(getActivity(), R.anim.layout_fall_down);
    recyclerView.setLayoutAnimation(animationController);

    mEventsAdapter.setEventItemActionListener(new EventItemActionListener() {
        @Override
        public void onItemClicked(String eventId) {
            Bundle bundle = new Bundle();
            bundle.putString(EditFragment.ARG_EDIT_EVENT_ID, eventId);
            Navigation.findNavController(getView()).navigate(R.id.action_events_to_edit, bundle);
        }
    });
}
 
源代码3 项目: Synapse   文件: MainActivity.java
private void solveData() {
    mButler.clear();

    final boolean ready = isDataSetReady();

    if (ready) {
        final LayoutAnimationController controller =
                AnimationUtils.loadLayoutAnimation(this, R.anim.layout_animation_from_bottom);

        mRecyclerView.setLayoutAnimation(controller);
        mRecyclerView.scheduleLayoutAnimation();

        dataSetReady();
    } else {
        dataSetUnready();
    }
}
 
源代码4 项目: PHONK   文件: ProjectListFragment.java
public void loadFolder(String folder) {
    clear();

    mProjectFolder = folder;

    mListProjects = PhonkScriptHelper.listProjects(mProjectFolder, mOrderByName);
    mProjectAdapter.setArray(mListProjects);
    mGrid.setAdapter(mProjectAdapter);
    // mGrid.clearAnimation();
    // mGrid.startAnimation(mAnim);

    notifyAddedProject();

    final Context context = mGrid.getContext();
    final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, R.anim.fav_grid_anim);

    mGrid.setLayoutAnimation(controller);
    mGrid.getAdapter().notifyDataSetChanged();
    mGrid.scheduleLayoutAnimation();

    MLog.d(TAG, "loading " + mProjectFolder);
}
 
@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();
}
 
源代码6 项目: LLApp   文件: MyArticleTypeFragment.java
@Override
protected void onInitView() {
    mSwipeRefreshLayout.setColorSchemeResources(
            R.color.username1,
            R.color.username2,
            R.color.username3,
            R.color.username4,
            R.color.username5,
            R.color.username6);
    mSwipeRefreshLayout.setOnRefreshListener(this);

    mAdapter = new CategoryAdapter(getContext(),R.layout.category_item,mDatas);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.addItemDecoration(new RecycleViewDivider(getActivity(), LinearLayoutManager.HORIZONTAL));
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setOnLoadMoreListener(this);
    mRecyclerView.setEmpty();
    LayoutAnimationController lac = new LayoutAnimationController(AnimationUtils.loadAnimation(getContext(),R.anim.fade_in));
    lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
    mRecyclerView.setLayoutAnimation(lac);
    mRecyclerView.startLayoutAnimation();

    getData(true);

}
 
源代码7 项目: rootvalidator   文件: ValidatorFragment.java
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    AnimationSet set = new AnimationSet(true);
    Animation fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setDuration(350);
    set.addAnimation(fadeIn);
    Animation dropDown = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f
    );
    dropDown.setDuration(400);
    set.addAnimation(dropDown);
    LayoutAnimationController controller = new LayoutAnimationController(set, 0.2f);
    recyclerView.setLayoutAnimation(controller);

    recyclerView.setAdapter(adapter);

    fab.setVisibility(View.INVISIBLE);
    introBox.setVisibility(View.VISIBLE);
    workingBox.setVisibility(View.GONE);
    recyclerView.setVisibility(View.GONE);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
}
 
源代码8 项目: android_tv_metro   文件: MainMenuMgr.java
private void intLayoutAnim()
{
    Animation slideIn = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_SELF, -1, TranslateAnimation.ABSOLUTE, 0,
            TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.ABSOLUTE, 0);
    slideIn.setDuration(KAnimTimeShort);
    mAnimIn = new LayoutAnimationController(slideIn, LayoutAnimDelay);

    Animation slideOut = new TranslateAnimation(TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.RELATIVE_TO_SELF, -1,
             TranslateAnimation.ABSOLUTE, 0, TranslateAnimation.ABSOLUTE, 0);
    slideOut.setDuration(KAnimTimeShort);

    slideOut.setFillAfter(true);
    mAnimOut = new LayoutAnimationController(slideOut, LayoutAnimDelay);
    mAnimOut.setOrder(LayoutAnimationController.ORDER_REVERSE);

    mainMenu.setLayoutAnimation(mAnimIn);
    mHideShowListener = new HideShowListener();
    mainMenu.setLayoutAnimationListener(mHideShowListener);

    mReady.autoSetVal(true, AnimationBlockTimer);
}
 
源代码9 项目: SoloPi   文件: CaseStepEditFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_case_step_edit, container, false);
    // 加载相关控件
    tagGroup = (TagFlowLayout) root.findViewById(R.id.case_step_edit_tag_group);
    dragList = (SlideAndDragListView) root.findViewById(R.id.case_step_edit_drag_list);

    LayoutAnimationController controller = new LayoutAnimationController(
            AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in));
    controller.setDelay(0);
    dragList.setLayoutAnimation(controller);
    return root;
}
 
源代码10 项目: AutoTest   文件: ActionSheetDialog.java
private void init() {
    widthScale(0.95f);
    /** LayoutAnimation */
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF,
            0f, Animation.RELATIVE_TO_SELF, 6f, Animation.RELATIVE_TO_SELF, 0);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(350);
    animation.setStartOffset(150);

    mLac = new LayoutAnimationController(animation, 0.12f);
    mLac.setInterpolator(new DecelerateInterpolator());
}
 
源代码11 项目: styT   文件: ws_Main3Activity.java
private void runLayoutAnimation(final RecyclerView recyclerView) {
    final Context context = recyclerView.getContext();
    final LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(context, R.anim.layout_animation_fall_down);
    recyclerView.setLayoutAnimation(controller);
    recyclerView.getAdapter().notifyDataSetChanged();
    recyclerView.scheduleLayoutAnimation();
}
 
public void generateListTechnology(List<Tenant> tenantList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId);
        tenantAdapter = new TenantAdapter(getContext(), tenantList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getContext(), 2);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(tenantAdapter);
    }catch (Exception e){

    }

}
 
public void generateListTechnology(List<Event> eventList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), resId);
        eventAdapter = new EventAdapter(getContext(), eventList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(getContext(), 1);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(eventAdapter);
    }catch (Exception e){

    }

}
 
public void generateListPengaduan(List<Pengaduan> pengaduanList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);

        pengaduanAdapter = new PengaduanAdapter(this, pengaduanList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(pengaduanAdapter);
    }catch (Exception e){

    }
}
 
public void generateListTechnology(List<Event> eventList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(EventTenantActivity.this, 1);
        eventAdapter = new EventAdapter(this, eventList);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(eventAdapter);
    }catch (Exception e){

    }

}
 
public void generateListReview(List<Review> reviewList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);

        reviewAdapter = new ReviewAdapter(this, reviewList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(reviewAdapter);
    }catch (Exception e){

    }
}
 
public void generateListTechnology(List<Gallery> tenantList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
        galleryAdapter = new GalleryAdapter(this, tenantList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 3);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(galleryAdapter);
    }catch (Exception e){

    }
}
 
public void generateListTechnology(List<Produk> produkList) {
    try {
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
        produkAdapter = new ProdukAdapter(this, produkList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(produkAdapter);
    } catch (Exception e) {

    }
}
 
public void generateListReview(List<Review> reviewList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);

        reviewAdapter = new ReviewAdapter(this, reviewList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(reviewAdapter);
    }catch (Exception e){

    }
}
 
public void generateListPengaduan(List<Pengaduan> pengaduanList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);

        pengaduanAdapter = new PengaduanAdapter(this, pengaduanList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 1);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(pengaduanAdapter);
    }catch (Exception e){

    }
}
 
public void generateListTechnology(List<Gallery> tenantList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
        galleryAdapter = new GalleryAdapter(this, tenantList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 3);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(galleryAdapter);
    }catch (Exception e){

    }
}
 
public void generateListTechnology(List<Produk> produkList){
    try{
        int resId = R.anim.layout_animation_from_down;
        LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
        produkAdapter = new ProdukAdapter(this, produkList);
        RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2);
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutAnimation(animation);
        recyclerView.setAdapter(produkAdapter);
    }catch (Exception e){

    }
}
 
源代码23 项目: HaoReader   文件: AudioBookFragment.java
private void startLayoutAnimationIfNeed() {
    if (mPresenter.getNeedAnim()) {
        if (rvBookshelf.getLayoutAnimation() == null) {
            LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.anim_bookshelf_layout);
            rvBookshelf.setLayoutAnimation(animation);
        } else {
            rvBookshelf.startLayoutAnimation();
        }
    }
}
 
源代码24 项目: HaoReader   文件: BookListFragment.java
@Override
public void startLayoutAnimation() {
    if (mPresenter.getNeedAnim()) {
        if (rvBookshelf.getLayoutAnimation() == null) {
            LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.anim_bookshelf_layout);
            rvBookshelf.setLayoutAnimation(animation);
        } else {
            rvBookshelf.startLayoutAnimation();
        }
    } else {
        if (rvBookshelf.getLayoutAnimation() != null) {
            rvBookshelf.setLayoutAnimation(null);
        }
    }
}
 
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_announcement_list, container, false);
    // 查找xml文件中的对象并保存进Java变量
    mRecyclerView = linearLayout.findViewById(R.id.recycler_announcement_list);
    mAnnouncementListSwipeContainer = linearLayout.findViewById(R.id.announcement_swipe_container);

    // 设置动画
    LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down);
    mAnnouncementListSwipeContainer.setLayoutAnimation(animation);
    // 设置刷新的监听类为此类(监听函数onRefresh)
    mAnnouncementListSwipeContainer.setOnRefreshListener(this);
    mAnnouncementListSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent));

    FragmentActivity fa = getActivity();
    // 为了消除编译器Warning,需要判断一下是不是null,其实这基本上不可能出现null
    if (fa == null) {
        return linearLayout;
    }

    // SharedPreferences sharedPreferences = fa.getSharedPreferences("pinnedAnnouncementList", Context.MODE_PRIVATE);
    adapter = new AnnouncementListOfEachCourseAdapter(new ArrayList<AnnouncementInfo>(), this);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(adapter);
    courseId = getActivity().getIntent().getStringExtra("CourseId");

    // 显示Loading的小动画,并在后台读取课程列表
    showLoading(true);
    mLoadingTask = new AnnouncementLoadingTask();
    mLoadingTask.execute((Void) null);

    return linearLayout;
}
 
源代码26 项目: PKUCourses   文件: CourseActionFragment.java
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_course_action, container, false);
    // 查找xml文件中的对象并保存进Java变量
    mRecyclerView = linearLayout.findViewById(R.id.recycler_actions);
    mCourseActionSwipeContainer = linearLayout.findViewById(R.id.course_action_swipe_container);

    // 设置动画
    LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down);
    mCourseActionSwipeContainer.setLayoutAnimation(animation);
    // 设置刷新的监听类为此类(监听函数onRefresh)
    mCourseActionSwipeContainer.setEnabled(false);

    adapter = new CourseActionsAdapter(new ArrayList<String>(), this);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(adapter);

    FragmentActivity fa = getActivity();
    if (fa == null) {
        courseId = "";
    } else {
        String xmlStr = getActivity().getIntent().getStringExtra("CourseActionsXML");
        if (xmlStr == null) {
            courseId = getActivity().getIntent().getStringExtra("CourseId");
            // 显示Loading的小动画,并在后台读取课程列表
            showLoading(true);
            mLoadingTask = new CourseActionFragment.ActionsLoadingTask();
            mLoadingTask.execute((Void) null);
        } else {
            attachXmlToView(Utils.stringToNode(xmlStr));
        }
    }

    return linearLayout;
}
 
源代码27 项目: PKUCourses   文件: GradeBookOfEachCourseFragment.java
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    LinearLayout linearLayout = (LinearLayout) inflater.inflate(R.layout.fragment_grade_book_list, container, false);
    // 查找xml文件中的对象并保存进Java变量
    mRecyclerView = linearLayout.findViewById(R.id.recycler_grades);
    mGradeBookSwipeContainer = linearLayout.findViewById(R.id.grade_book_list_swipe_container);

    // 设置动画
    LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down);
    mGradeBookSwipeContainer.setLayoutAnimation(animation);
    // 设置刷新的监听类为此类(监听函数onRefresh)
    mGradeBookSwipeContainer.setOnRefreshListener(this);
    mGradeBookSwipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorAccent));

    FragmentActivity fa = getActivity();
    // 为了消除编译器Warning,需要判断一下是不是null,其实这基本上不可能出现null
    if (fa == null) {
        return linearLayout;
    }
    adapter = new GradeBookListRecyclerViewAdapter(new ArrayList<GradeInfo>());
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(adapter);
    courseId = getActivity().getIntent().getStringExtra("CourseId");

    // 显示Loading的小动画,并在后台读取课程列表
    showLoading(true);
    mLoadingTask = new LoadingTask();
    mLoadingTask.execute((Void) null);

    return linearLayout;
}
 
源代码28 项目: NewsApp   文件: NewsFragment.java
@Override
public void onNewsItemClicked(Article article) {
    Timber.d("Recieved article");
    Intent intent = new Intent(getContext(), DetailActivity.class);
    intent.putExtra(DetailActivity.PARAM_ARTICLE, article);
    final LayoutAnimationController controller =
            AnimationUtils.loadLayoutAnimation(getContext(), R.anim.layout_animation_fall_down);
    binding.rvNewsPosts.setLayoutAnimation(controller);
    binding.rvNewsPosts.scheduleLayoutAnimation();
    startActivity(intent);
    if (getActivity() != null) {
        getActivity().overridePendingTransition(R.anim.slide_up_animation, R.anim.fade_exit_transition);
    }
}
 
源代码29 项目: SuperDialog   文件: SuperDialog.java
private LayoutAnimationController getLayoutAnimation() {
    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 2f, Animation.RELATIVE_TO_SELF,
            0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setDuration(550);
    LayoutAnimationController layoutAnimationController = new LayoutAnimationController(animation, 0.12f);
    layoutAnimationController.setInterpolator(new DecelerateInterpolator());
    return layoutAnimationController;
}
 
源代码30 项目: AndroidAll   文件: LayoutAnimationFragment.java
private void setAnimationByCode(){
    Animation animation= AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_left);
    //得到一个LayoutAnimationController对象;
    LayoutAnimationController controller = new LayoutAnimationController(animation);
    //设置控件显示的顺序;
    controller.setOrder(LayoutAnimationController.ORDER_REVERSE);
    //设置控件显示间隔时间;
    controller.setDelay(0.5f);
    //为ListView设置LayoutAnimationController属性;
    listView.setLayoutAnimation(controller);
    listView.startLayoutAnimation();
}