zoukankan      html  css  js  c++  java
  • 画图类

     1 package cativity.cyq.layoutanimation;
     2 
     3 import android.support.v7.app.ActionBarActivity;
     4 import android.support.v4.app.Fragment;
     5 import android.os.Bundle;
     6 import android.view.LayoutInflater;
     7 import android.view.Menu;
     8 import android.view.MenuItem;
     9 import android.view.View;
    10 import android.view.ViewGroup;
    11 import android.view.animation.LayoutAnimationController;
    12 import android.view.animation.ScaleAnimation;
    13 import android.widget.LinearLayout;
    14 
    15 
    16 public class MainActivity extends ActionBarActivity {
    17 
    18     @Override
    19     protected void onCreate(Bundle savedInstanceState) {
    20         super.onCreate(savedInstanceState);
    21         setContentView(R.layout.activity_main);
    22         if (savedInstanceState == null) {
    23             getSupportFragmentManager().beginTransaction().addToBackStack(null)
    24                     .add(R.id.container, new PlaceholderFragment())
    25                     .commit();
    26         }
    27     }
    28 
    29     public static class PlaceholderFragment extends Fragment {
    30 
    31         public PlaceholderFragment() {
    32         }
    33 
    34         @Override
    35         public View onCreateView(LayoutInflater inflater, ViewGroup container,
    36                                  Bundle savedInstanceState) {
    37             LinearLayout rootView = (LinearLayout) inflater.inflate(R.layout.fragment_main, container, false);
    38             ScaleAnimation sAnimatio = new ScaleAnimation(0, 1, 0, 1);
    39             sAnimatio.setDuration(200);
    40             //使用布局动画管理器
    41 
    42             LayoutAnimationController layoutAniController = new LayoutAnimationController(sAnimatio, 0.9f);
    43             rootView.setLayoutAnimation(layoutAniController);
    44 
    45             rootView.findViewById(R.id.skipto).setOnClickListener(new View.OnClickListener() {
    46                 @Override
    47                 public void onClick(View v) {
    48                     getFragmentManager().beginTransaction().addToBackStack(null)
    49                             .replace(R.id.container, new MyFragment())
    50                             .commit();
    51 
    52 
    53                 }
    54             });
    55 
    56             return rootView;
    57         }
    58     }
    59 
    60     @Override
    61     public boolean onCreateOptionsMenu(Menu menu) {
    62         getMenuInflater().inflate(R.menu.menu_main, menu);
    63         return true;
    64     }
    65 
    66     @Override
    67     public boolean onOptionsItemSelected(MenuItem item) {
    68         int id = item.getItemId();
    69         if (id == R.id.action_settings) {
    70             return true;
    71         }
    72 
    73         return super.onOptionsItemSelected(item);
    74     }
    75 
    76 
    77 }
  • 相关阅读:
    查看linux版本的三种常用方法
    CentOS和Redhat发行版linux内核版本的对应关系
    swift的异常处理:本质是错误信息的传递方式
    构建法则第一条:有什么材料做什么饭
    待解决问题 代码阅读
    iOS: 聊聊 Designated Initializer(指定初始化函数):NS_DESIGNATED_INITIALIZER
    整合与构建的能力是创造性思维的重要体现
    iOS网络缓存的系统实现是一个烂尾工程
    (动态)代理于HOOK的区别于关系
    iOS 网络缓存总结
  • 原文地址:https://www.cnblogs.com/chenyangqi/p/4670925.html
Copyright © 2011-2022 走看看