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

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

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

CardView.getCardElevation介绍

暂无

代码示例

代码示例来源:origin: qs-lll/ExpandingPager

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  this.fragmentFront = getFragmentTop();
  this.fragmentBottom = getFragmentBottom();
  if (fragmentFront != null && fragmentBottom != null) {
    getChildFragmentManager().beginTransaction()
        .replace(R.id.front, fragmentFront)
        .replace(R.id.bottomLayout, fragmentBottom)
        .commit();
  }
  back = (CardView) view.findViewById(R.id.back);
  front = (CardView) view.findViewById(R.id.front);
  layout3 = (CardView) view.findViewById(R.id.bottomLayout);
  view.setOnClickListener(new OnClick());
  setupDownGesture(view);
  defaultCardElevation = front.getCardElevation();
}

代码示例来源:origin: lingochamp/okdownload

@Override public void onClick(View v) {
    final boolean started = v.getTag() != null;
    if (started) {
      controller.stop();
    } else {
      v.setTag(new Object());
      actionTv.setText(R.string.cancel);
      // to start
      controller.start(serialRb.isChecked());
      adapter.notifyDataSetChanged();
      serialRb.setEnabled(false);
      parallelRb.setEnabled(false);
      deleteActionView.setEnabled(false);
      deleteActionView.setTag(deleteActionView.getCardElevation());
      deleteActionView.setCardElevation(0);
      deleteActionTv.setEnabled(false);
    }
  }
});

代码示例来源:origin: woxblom/DragListView

@Override
  public void onEndDragAnimation(View dragView) {
    CardView dragCard = dragView.findViewById(R.id.card);
    ObjectAnimator anim = ObjectAnimator.ofFloat(dragCard, "CardElevation", dragCard.getCardElevation(), 6);
    anim.setInterpolator(new DecelerateInterpolator());
    anim.setDuration(ANIMATION_DURATION);
    anim.start();
  }
}

代码示例来源:origin: woxblom/DragListView

@Override
public void onStartDragAnimation(View dragView) {
  CardView dragCard = dragView.findViewById(R.id.card);
  ObjectAnimator anim = ObjectAnimator.ofFloat(dragCard, "CardElevation", dragCard.getCardElevation(), 40);
  anim.setInterpolator(new DecelerateInterpolator());
  anim.setDuration(ANIMATION_DURATION);
  anim.start();
}

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

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.fragment_adapter, container, false);
  mCardView = (CardView) view.findViewById(R.id.cardView);
  mCardView.setMaxCardElevation(mCardView.getCardElevation()
      * CardAdapter.MAX_ELEVATION_FACTOR);
  return view;
}

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

@Override
public Object instantiateItem(ViewGroup container, int position) {
  View view = LayoutInflater.from(container.getContext())
      .inflate(R.layout.adapter, container, false);
  container.addView(view);
  bind(mData.get(position), view);
  CardView cardView = (CardView) view.findViewById(R.id.cardView);
  if (mBaseElevation == 0) {
    mBaseElevation = cardView.getCardElevation();
  }
  cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
  mViews.set(position, cardView);
  return view;
}

代码示例来源:origin: woxblom/DragListView

@Override
public void onBindDragView(View clickedView, View dragView) {
  CharSequence text = ((TextView) clickedView.findViewById(R.id.text)).getText();
  ((TextView) dragView.findViewById(R.id.text)).setText(text);
  CardView dragCard = dragView.findViewById(R.id.card);
  CardView clickedCard = clickedView.findViewById(R.id.card);
  dragCard.setMaxCardElevation(40);
  dragCard.setCardElevation(clickedCard.getCardElevation());
  // I know the dragView is a FrameLayout and that is why I can use setForeground below api level 23
  dragCard.setForeground(clickedView.getResources().getDrawable(R.drawable.card_view_drag_foreground));
}

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

@SuppressLint("DefaultLocale")
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
  View view = inflater.inflate(R.layout.item_viewpager, container, false);
  cardView = (CardView) view.findViewById(R.id.cardView);
  cardView.setMaxCardElevation(cardView.getCardElevation() * CardAdapter.MAX_ELEVATION_FACTOR);
  TextView title = (TextView) view.findViewById(R.id.title);
  Button button = (Button)view.findViewById(R.id.button);
  title.setText(String.format("Card %d", getArguments().getInt("position")));
  button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      Toast.makeText(getActivity(), "Button in Card " + getArguments().getInt("position")
          + "Clicked!", Toast.LENGTH_SHORT).show();
    }
  });
  return view;
}

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

mBaseElevation = cardView.getCardElevation();

代码示例来源:origin: jbruchanov/AnUitor

@Override
  protected HashMap<String, Object> fillValues(View v, HashMap<String, Object> data, HashMap<String, Object> parentData) {
    super.fillValues(v, data, parentData);

    CardView cv = (CardView) v;
    data.put("CardElevation", cv.getCardElevation());
    data.put("ContentPaddingBottom", cv.getContentPaddingBottom());
    data.put("ContentPaddingLeft", cv.getContentPaddingLeft());
    data.put("ContentPaddingRight", cv.getContentPaddingRight());
    data.put("ContentPaddingTop", cv.getContentPaddingTop());
    data.put("MaxCardElevation", cv.getMaxCardElevation());
    data.put("PreventCornerOverlap", cv.getPreventCornerOverlap());
    data.put("Radius", cv.getRadius());
    data.put("UseCompatPadding", cv.getUseCompatPadding());

    return data;
  }
}

相关文章