本文整理汇总了Java中android.support.v7.widget.CardView.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.findViewById方法的具体用法?Java CardView.findViewById怎么用?Java CardView.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.findViewById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == VIEW_TYPE_ITEM || viewType == VIEW_TYPE_TIME) {
CardView view = (CardView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_ops, parent, false);
OpsItemViewHolder viewHolder = new OpsItemViewHolder(mFragment, view);
viewHolder.cardView = view;
viewHolder.iconView = view.findViewById(R.id.icon);
viewHolder.nameView = view.findViewById(R.id.name);
viewHolder.labelView = view.findViewById(R.id.label);
viewHolder.timeView = view.findViewById(R.id.time);
viewHolder.modeView = view.findViewById(R.id.mode);
if (cardColorBackgroundDefault == Color.TRANSPARENT) {
cardColorBackgroundDefault = view.getCardBackgroundColor().getDefaultColor();
cardColorBackgroundHighlight = ColorUtils.resolveColor(getActivity(),
android.R.attr.colorControlHighlight);
}
view.setOnClickListener(this);
return viewHolder;
} else {
return null;
}
}
示例2: updateStatus
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void updateStatus(CharSequence text, @ColorInt int color, Drawable icon) {
if (mViewHolder != null) {
CardView statusCard = (CardView) ((ViewGroup) mViewHolder.itemView).getChildAt(0);
TextView status = statusCard.findViewById(android.R.id.text1);
if (icon != null) {
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
status.setCompoundDrawablesRelative(icon, null, null, null);
} else {
status.setCompoundDrawablesRelative(null, null, null, null);
}
status.setText(text);
statusCard.setCardBackgroundColor(color);
}
}
示例3: ViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public ViewHolder(CardView view) {
super(view);
cardView = view;
bookName = (TextView) view.findViewById(R.id.bookName);
authorName = (TextView) view.findViewById(R.id.author);
status = (TextView) view.findViewById(R.id.status);
summary = (TextView) view.findViewById(R.id.bookDescription);
imageView = (ImageView) view.findViewById(R.id.thumbImage);
}
示例4: ViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public ViewHolder(CardView cardView) {
super(cardView);
this.cardView = cardView;
this.cardView.setOnClickListener(this);
merchant = (TextView) cardView.findViewById(R.id.text_view_merchant);
category = (TextView) cardView.findViewById(R.id.text_view_category);
validUntil = (TextView) cardView.findViewById(R.id.text_view_valid_until);
couponCode = (TextView) cardView.findViewById(R.id.text_view_coupon_code);
imageViewCouponState = (ImageView) cardView.findViewById(R.id.image_view_coupon_state);
textViewCouponState = (TextView) cardView.findViewById(R.id.text_view_coupon_state);
}
示例5: ViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public ViewHolder(CardView cardView) {
super(cardView);
this.cardView = cardView;
merchant = (TextView) cardView.findViewById(R.id.text_view_merchant);
category = (TextView) cardView.findViewById(R.id.text_view_category);
validUntil = (TextView) cardView.findViewById(R.id.text_view_valid_until);
couponCode = (TextView) cardView.findViewById(R.id.text_view_coupon_code);
imageViewCouponState = (ImageView) cardView.findViewById(R.id.image_view_coupon_state);
textViewCouponState = (TextView) cardView.findViewById(R.id.text_view_coupon_state);
}
示例6: initScrollView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void initScrollView() {
viewWoche = new StatistikView(getApplicationContext());
viewWoche.setData(sqLiteConnector.getData(0));
viewMonat = new StatistikView(getApplicationContext());
viewMonat.setData(sqLiteConnector.getData(1));
viewJahr = new StatistikView(getApplicationContext());
viewJahr.setData(sqLiteConnector.getData(2));
viewAlles = new StatistikViewBalken(getApplicationContext());
viewAlles.setData(sqLiteConnector.getAverage());
final CardView cardWoche = (CardView) getLayoutInflater().inflate(R.layout.card_view_vertical, null);
cardWoche.setCardElevation(GraphicUtils.dpToPx(4));
final CardView cardMonat = (CardView) getLayoutInflater().inflate(R.layout.card_view_vertical, null);
cardMonat.setCardElevation(GraphicUtils.dpToPx(4));
final CardView cardJahr = (CardView) getLayoutInflater().inflate(R.layout.card_view_vertical, null);
cardJahr.setCardElevation(GraphicUtils.dpToPx(4));
final CardView cardAlles = (CardView) getLayoutInflater().inflate(R.layout.card_view_vertical, null);
cardAlles.setCardElevation(GraphicUtils.dpToPx(4));
final TextView titleWoche = cardWoche.findViewById(R.id.textView);
titleWoche.setText("Letzte Woche");
final TextView titleMonat = cardMonat.findViewById(R.id.textView);
titleMonat.setText("Letzter Monat");
final TextView titleJahr = cardJahr.findViewById(R.id.textView);
titleJahr.setText("Letztes Jahr");
final TextView titleAlles = cardAlles.findViewById(R.id.textView);
titleAlles.setText("Gesamt");
final ViewGroup layoutWoche = cardWoche.findViewById(R.id.layout);
layoutWoche.addView(viewWoche);
final ViewGroup layoutMonat = cardMonat.findViewById(R.id.layout);
layoutMonat.addView(viewMonat);
final ViewGroup layoutJahr = cardJahr.findViewById(R.id.layout);
layoutJahr.addView(viewJahr);
final ViewGroup layoutAlles = cardAlles.findViewById(R.id.layout);
layoutAlles.addView(viewAlles);
new Handler().post(new Runnable() {
@Override
public void run() {
View scrollView = findViewById(R.id.scrollView);
int height;
while ((height = scrollView.getHeight()) == 0)
;
viewWoche.setMinimumHeight(height * 4 / 5);
viewMonat.setMinimumHeight(height * 4 / 5);
viewJahr.setMinimumHeight(height * 4 / 5);
viewAlles.setMinimumHeight(height * 4 / 5);
final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, height / 64, 0, height / 64);
final LinearLayout container = findViewById(R.id.linearLayout);
container.addView(cardWoche, layoutParams);
container.addView(cardMonat, layoutParams);
container.addView(cardJahr, layoutParams);
container.addView(cardAlles, layoutParams);
}
});
}