033 initView();
034 getScreenWidth();
035 }
036
037 private void initView(){
038 findViewById(R.id.button1).setOnClickListener(this);
039 findViewById(R.id.button2).setOnClickListener(this);
040 findViewById(R.id.button3).setOnClickListener(this);
041 findViewById(R.id.button4).setOnClickListener(this);
042 mContentView = (LinearLayout) findViewById(R.id.content_layout);
043 mContentViewParent = (LinearLayout)findViewById(R.id.content_layout_parent);
044 }
045
046 /**获取屏幕宽度*/
047 private void getScreenWidth(){
048 DisplayMetrics metric = new DisplayMetrics();
049 getWindowManager().getDefaultDisplay().getMetrics(metric);
050 mSreenWidth = metric.widthPixels; // 屏幕宽度(像素)