zoukankan      html  css  js  c++  java
  • 动画布局管理器

    package cativity.cyq.layoutanimation;
    
    import android.support.v7.app.ActionBarActivity;
    import android.support.v4.app.Fragment;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.view.ViewGroup;
    import android.view.animation.LayoutAnimationController;
    import android.view.animation.ScaleAnimation;
    import android.widget.LinearLayout;
    
    
    public class MainActivity extends ActionBarActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            if (savedInstanceState == null) {
                getSupportFragmentManager().beginTransaction().addToBackStack(null)
                        .add(R.id.container, new PlaceholderFragment())
                        .commit();
            }
        }
    
        public static class PlaceholderFragment extends Fragment {
    
            public PlaceholderFragment() {
            }
    
            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                     Bundle savedInstanceState) {
                LinearLayout rootView = (LinearLayout) inflater.inflate(R.layout.fragment_main, container, false);
                ScaleAnimation sAnimatio = new ScaleAnimation(0, 1, 0, 1);
                sAnimatio.setDuration(200);
                //使用布局动画管理器
    
                LayoutAnimationController layoutAniController = new LayoutAnimationController(sAnimatio, 0.9f);
                rootView.setLayoutAnimation(layoutAniController);
    
                rootView.findViewById(R.id.skipto).setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        getFragmentManager().beginTransaction().addToBackStack(null)
                                .replace(R.id.container, new MyFragment())
                                .commit();
    
    
                    }
                });
    
                return rootView;
            }
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.menu_main, menu);
            return true;
        }
    
        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            int id = item.getItemId();
            if (id == R.id.action_settings) {
                return true;
            }
    
            return super.onOptionsItemSelected(item);
        }
    
    
    }
  • 相关阅读:
    本来一行可以代替的树节点搜索
    mssql 重新开始标识
    TabContainer实现服务器端回传
    CSS中图片路径的问题
    Javascript在IE下设置innerHTML时出现"未知的运行时错误"
    sql union和union all的用法及效率
    关于动态添加TabPanel遇到的问题以及思考
    关于linq to sql调用存储过程,出现"无法枚举查询结果多次"的问题
    SQL Server 2005连接服务器时的26号错误解决!
    SQL 2000和2005 获取两表的差集
  • 原文地址:https://www.cnblogs.com/chenyangqi/p/4670913.html
Copyright © 2011-2022 走看看