本文整理汇总了Java中android.support.v7.widget.CardView.getCardElevation方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.getCardElevation方法的具体用法?Java CardView.getCardElevation怎么用?Java CardView.getCardElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.getCardElevation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instantiateItem
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@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;
}
示例2: instantiateItem
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = LayoutInflater.from(container.getContext())
.inflate(R.layout.card_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;
}
示例3: onLongClick
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
void onLongClick() {
Task currentTask = taskList.get(position);
CardView cardView = (CardView)itemView;
float initialElevation = cardView.getCardElevation();
cardView.setCardElevation(cardView.getCardElevation() * 15);
PopupMenu menu = new PopupMenu(context, itemView);
menu.inflate(R.menu.pop_up_menu);
menu.setOnMenuItemClickListener(item -> {
switch (item.getItemId()){
case R.id.edit_task:
actions.editTask(currentTask, position);
return true;
case R.id.delete_task:
actions.deleteTask(currentTask, position);
}
return false;
});
menu.setOnDismissListener(popupMenu ->
cardView.setCardElevation(initialElevation));
menu.show();
}
示例4: instantiateItem
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
View view = LayoutInflater.from(container.getContext())
.inflate(R.layout.item_card, container, false);
container.addView(view);
bind(mData.get(position), view);
CardView cardView = (CardView) view.findViewById(R.id.card_view);
if (mBaseElevation == 0) {
mBaseElevation = cardView.getCardElevation();
}
cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
mViews.set(position, cardView);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mOnItemClickListener) {
mOnItemClickListener.onClick(position);
}
}
});
return view;
}
示例5: instantiateItem
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(mViewList.get(position));//添加页卡
CardView cardView = (CardView)mViewList.get(position).findViewById(R.id.cardView);
if (mBaseElevation == 0) {
mBaseElevation = cardView.getCardElevation();
}
cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
mViewList.set(position, cardView);
return mViewList.get(position);
}