WEB开发网
开发学院手机开发Android 开发 Android 抽屉式Activity 阅读

Android 抽屉式Activity

 2012-07-17 14:06:29 来源:WEB开发网   
核心提示: @Override public void onItemClick( AdapterView<?> arg0, View arg1, int arg2, long arg3) {// if (String[0]) {//// }//if (arg2 == 1) { Intent intent = new
  @Override
  public void onItemClick(
   AdapterView<?> arg0,
   View arg1,
   int arg2, long arg3) {
  // if (String[0]) {
  //
  // }
  //
  if (arg2 == 1) {
   Intent intent = new Intent(
    SettingActivity.this,
    Gongzibai.class);
   startActivity(intent);
   finish();
  }
  
  if (arg2==3) {
   
   Intent intent1 = new Intent(
    SettingActivity.this,
    Gongzibai1.class);
   startActivity(intent1);
   finish();
   
  }
  close();
  }
 });
 open();
 }
 public void initAnim() {
 // 采用了绝对布局,绝对布局是view的左上角从(0,0)开始
 @SuppressWarnings("deprecation")
 final android.widget.AbsoluteLayout.LayoutParams lp = new android.widget.AbsoluteLayout.LayoutParams(
  LayoutParams.FILL_PARENT,
  LayoutParams.FILL_PARENT,
  0, 0);
 findViewById(
  R.id.slideout_placeholder)
  .setLayoutParams(lp);
 // 屏幕的宽度
 int displayWidth = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
  .getDefaultDisplay()
  .getWidth();
 // 右边的位移量,60dp转换成px
 int sWidth = (int) TypedValue
  .applyDimension(
   TypedValue.COMPLEX_UNIT_DIP,
   60,
   getResources()
    .getDisplayMetrics());
 // 将快照向右移动的偏移量
 final int shift = displayWidth
  - sWidth;
 // 向右移动的位移动画向右移动shift距离,y方向不变
 mStartAnimation = new TranslateAnimation(
  TranslateAnimation.ABSOLUTE,
  0,
  TranslateAnimation.ABSOLUTE,
  shift,
  TranslateAnimation.ABSOLUTE,
  0,
  TranslateAnimation.ABSOLUTE,
  0);

上一页  1 2 3 4 5 6 7  下一页

Tags:Android 抽屉式 Activity

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接