android.support.v7.widget.CardView.animate()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中android.support.v7.widget.CardView.animate()方法的一些代码示例,展示了CardView.animate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CardView.animate()方法的具体详情如下:
包路径:android.support.v7.widget.CardView
类名称:CardView
方法名:animate

CardView.animate介绍

暂无

代码示例

代码示例来源:origin: JinBoy23520/CoderToDeveloperByTCLer

public void enableScaling(boolean enable) {
  if (mScalingEnabled && !enable) {
    // shrink main card
    CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem());
    if (currentCard != null) {
      currentCard.animate().scaleY(1);
      currentCard.animate().scaleX(1);
    }
  }else if(!mScalingEnabled && enable){
    // grow main card
    CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem());
    if (currentCard != null) {
      currentCard.animate().scaleY(1.1f);
      currentCard.animate().scaleX(1.1f);
    }
  }
  mScalingEnabled = enable;
}

代码示例来源:origin: open-android/ViewPagerCards

public void enableScaling(boolean enable) {
  if (mScalingEnabled && !enable) {
    // shrink main card
    CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem());
    if (currentCard != null) {
      currentCard.animate().scaleY(1);
      currentCard.animate().scaleX(1);
    }
  }else if(!mScalingEnabled && enable){
    // grow main card
    CardView currentCard = mAdapter.getCardViewAt(mViewPager.getCurrentItem());
    if (currentCard != null) {
      currentCard.animate().scaleY(1.1f);
      currentCard.animate().scaleX(1.1f);
    }
  }
  mScalingEnabled = enable;
}

代码示例来源:origin: DevExchanges/ViewPagerCards

public void enableScaling(boolean enable) {
  if (scalingEnabled && !enable) {
    // shrink main card
    CardView currentCard = cardAdapter.getCardViewAt(viewPager.getCurrentItem());
    if (currentCard != null) {
      currentCard.animate().scaleY(1);
      currentCard.animate().scaleX(1);
    }
  }else if(!scalingEnabled && enable){
    // grow main card
    CardView currentCard = cardAdapter.getCardViewAt(viewPager.getCurrentItem());
    if (currentCard != null) {
      //enlarge the current item
      currentCard.animate().scaleY(1.1f);
      currentCard.animate().scaleX(1.1f);
    }
  }
  scalingEnabled = enable;
}

代码示例来源:origin: shrikanth7698/Custom-Navigation-Drawer

public void closeDrawer(){
  drawerClosing();
  navOpen=false;
  final int[] stateSet = {android.R.attr.state_checked * (navOpen ? 1 : -1)};
  menuIV.setImageState(stateSet,true);
  appbarTitleTV.animate().translationX(centerX).start();
  containerCV.animate().translationX(rootLayout.getX()).translationY(rootLayout.getY()).setDuration(500).start();
  final Handler handler = new Handler();
  handler.postDelayed(new Runnable() {
    @Override
    public void run() {
      drawerClosed();
      containerCV.setCardElevation((float) 0);
      containerCV.setRadius((float)0);
    }
  },500);
}

代码示例来源:origin: shrikanth7698/Custom-Navigation-Drawer

if(i>=1){
  backgroundCV.setVisibility(View.GONE);
  backgroundCV.animate().translationX(rootRL.getX()-backgroundCV.getWidth()).setDuration(1).start();
  titleTV.setVisibility(View.VISIBLE);

代码示例来源:origin: shrikanth7698/Custom-Navigation-Drawer

final TextView title1 = (TextView) menuLL.findViewWithTag("tv"+currentPos);
backCV1.animate().translationX(rootRL.getX()-backCV1.getWidth()).setDuration(300).start();
backCV.setVisibility(View.INVISIBLE);
System.out.println("Drawer Testing "+backCV.getTag());
backCV.animate().translationX(rootRL.getX()-backCV.getWidth()).setDuration(1).start();
backCV.animate().translationX(rootRL.getX()).setDuration(300).start();
backCV.setVisibility(View.VISIBLE);
title.setVisibility(View.GONE);

代码示例来源:origin: shrikanth7698/Custom-Navigation-Drawer

public void openDrawer(){
  drawerOpening();
  navOpen=true;
  final int[] stateSet = {android.R.attr.state_checked * (navOpen ? 1 : -1)};
  menuIV.setImageState(stateSet,true);
  containerCV.setCardElevation((float) 100.0);
  containerCV.setRadius((float)60.0);
  appbarTitleTV.animate().translationX(centerX+menuIV.getWidth()+menuIV.getWidth()/4+appbarTitleTV.getWidth()/2-appbarRL.getWidth()/2).start();
  containerCV.animate().translationX(rootLayout.getX() +(rootLayout.getWidth() / 8)+ (rootLayout.getWidth() / 2) ).translationY(250).setDuration(500).start();
  final Handler handler = new Handler();
  handler.postDelayed(new Runnable() {
    @Override
    public void run() {
      drawerOpened();
    }
  },250);
}

代码示例来源:origin: ywwynm/EverythingDone

ObjectAnimator.ofFloat(cv, "CardElevation", 2 * screenDensity).
    setDuration(96).start();
cv.animate().scaleX(1.0f).setDuration(96);
cv.animate().scaleY(1.0f).withEndAction(notifyDataSetRunnable).setDuration(96);

相关文章