本文整理汇总了Java中android.support.v7.widget.CardView.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java CardView.setOnClickListener方法的具体用法?Java CardView.setOnClickListener怎么用?Java CardView.setOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.CardView
的用法示例。
在下文中一共展示了CardView.setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public void initView() {
edit = (EditText) findViewById(R.id.et_edit_share_message_edit);
location = (TextView) findViewById(R.id.tv_edit_share_message_location);
visibility = (TextView) findViewById(R.id.tv_edit_share_message_visibility);
display = (RecyclerView) findViewById(R.id.rcv_edit_share_message_display);
RelativeLayout visibilityContainer = (RelativeLayout) findViewById(R.id.rl_edit_share_message_visibility_container);
video = (ImageView) findViewById(R.id.iv_edit_share_message_video);
RelativeLayout locationLayout = (RelativeLayout) findViewById(R.id.rl_edit_share_message_location);
urlAvatar = (ImageView) findViewById(R.id.iv_edit_share_message_url_avatar);
urlTitle = (TextView) findViewById(R.id.tv_edit_share_message_url_title);
mCardView = (CardView) findViewById(R.id.cv_edit_share_message_url_container);
selectedFriend = (SwipeMenuRecyclerView) findViewById(R.id.swrc_edit_share_message_visibility);
title = (TextView) findViewById(R.id.tv_edit_share_message_visibility_title);
visibilityContainer.setOnClickListener(this);
video.setOnClickListener(this);
locationLayout.setOnClickListener(this);
mCardView.setOnClickListener(this);
}
示例2: PackageStatusViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public PackageStatusViewHolder(View itemView) {
super(itemView);
textViewLocation = (AppCompatTextView) itemView.findViewById(R.id.textViewStatus);
textViewTime = (AppCompatTextView) itemView.findViewById(R.id.textViewTime);
timeLine = (Timeline) itemView.findViewById(R.id.timeLine);
contactCard = (CardView) itemView.findViewById(R.id.contactCard);
textViewPhone = (AppCompatTextView) itemView.findViewById(R.id.textViewPhone);
// Just handle the click event in adapter
// No need to set an {@link OnRecyclerViewItemClickListener}
contactCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String uri = textViewPhone.getText().toString();
if (uri.length() > 0) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + uri));
context.startActivity(intent);
}
}
});
}
示例3: onCreate
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tentang_kami);
cv_github = (CardView)findViewById(R.id.cv_github);
cv_github.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://github.com/setakarim/ingetin"));
startActivity(browserIntent);
}
});
}
示例4: createView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("AboutUs", R.string.AboutUs));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
finishFragment();
}
});
fragmentView = getParentActivity().getLayoutInflater().inflate(R.layout.about, null, false);
TextView tv1 = (TextView) fragmentView.findViewById(R.id.text_);
TextView tv2 = (TextView) fragmentView.findViewById(R.id.name_);
TextView tv4 = (TextView) fragmentView.findViewById(R.id.nazar_);
TextView tv5 = (TextView) fragmentView.findViewById(R.id.apps_);
CardView c1 = (CardView) fragmentView.findViewById(R.id.about_1);
CardView c3 = (CardView) fragmentView.findViewById(R.id.about_3);
CardView c4 = (CardView) fragmentView.findViewById(R.id.about_4);
c1.setOnClickListener(this);
c3.setOnClickListener(this);
c4.setOnClickListener(this);
FontManager.instance().setTypefaceImmediate(fragmentView);
return fragmentView;
}
示例5: populatePremisesCard
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void populatePremisesCard() {
CardView cardView = (CardView) mView.findViewById(R.id.cardViewPremisesAsset);
TextView textViewHeadCount = (TextView) mView.findViewById(R.id.textViewPremisesHeadCount);
TextView textViewCosts = (TextView) mView.findViewById(R.id.textViewPremisesCosts);
TextView textViewName = (TextView) mView.findViewById(R.id.textViewPremisesName);
PremisesAsset premises = mCompany.getPremises();
Resources res = AppTycoonApp.getContext().getResources();
String strHeadCount = res.getString(R.string.premises_asset_people_count,
mCompany.getEmployeeCount(), premises.getMaximumHeadCount());
String strCosts = res.getString(R.string.premises_asset_costs,
Utils.largeNumberToNiceString(premises.getCostPerSecond(), 2));
textViewHeadCount.setText(strHeadCount);
textViewCosts.setText(strCosts);
textViewName.setText(premises.getName());
// Clicking on the premises card opens a PremisesFragment.
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UiUpdateHandler.obtainReplaceFragmentMessage(MainActivity.FRAGMENT_PREMISES).sendToTarget();
}
});
}
示例6: MovieViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public MovieViewHolder(View itemView) {
super(itemView);
movieCard = (CardView) itemView.findViewById(R.id.card_view_show_cast);
moviePosterImageView = (ImageView) itemView.findViewById(R.id.image_view_show_cast);
movieTitleTextView = (TextView) itemView.findViewById(R.id.text_view_title_show_cast);
castCharacterTextView = (TextView) itemView.findViewById(R.id.text_view_cast_character_show_cast);
moviePosterImageView.getLayoutParams().width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.31);
moviePosterImageView.getLayoutParams().height = (int) ((mContext.getResources().getDisplayMetrics().widthPixels * 0.31) / 0.66);
movieCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, MovieDetailActivity.class);
intent.putExtra(Constant.MOVIE_ID, mMovieCasts.get(getAdapterPosition()).getId());
mContext.startActivity(intent);
}
});
}
示例7: onCreateView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false);
currentAddressQrView = (ImageView) view.findViewById(R.id.bitcoin_address_qr);
final CardView currentAddressQrCardView = (CardView) view.findViewById(R.id.bitcoin_address_qr_card);
currentAddressQrCardView.setCardBackgroundColor(Color.WHITE);
currentAddressQrCardView.setPreventCornerOverlap(false);
currentAddressQrCardView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
handleShowQRCode();
}
});
return view;
}
示例8: TVShowViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public TVShowViewHolder(View itemView) {
super(itemView);
tvShowCard = (CardView) itemView.findViewById(R.id.card_view_show_cast);
tvShowPosterImageView = (ImageView) itemView.findViewById(R.id.image_view_show_cast);
tvShowTitleTextView = (TextView) itemView.findViewById(R.id.text_view_title_show_cast);
castCharacterTextView = (TextView) itemView.findViewById(R.id.text_view_cast_character_show_cast);
tvShowPosterImageView.getLayoutParams().width = (int) (mContext.getResources().getDisplayMetrics().widthPixels * 0.31);
tvShowPosterImageView.getLayoutParams().height = (int) ((mContext.getResources().getDisplayMetrics().widthPixels * 0.31) / 0.66);
tvShowCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, TVShowDetailActivity.class);
intent.putExtra(Constant.TV_SHOW_ID, mTVCasts.get(getAdapterPosition()).getId());
mContext.startActivity(intent);
}
});
}
示例9: createCardView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void createCardView(ViewHolder holder, List<Point> points) {
for (int i = 0; i < points.size(); i++) {
final Point point = points.get(i);
View pointView = LayoutInflater.from(mContext).inflate(R.layout.carview_review, holder.ly_carview, false);
TextView pointName = (TextView) pointView.findViewById(R.id.tv_carview);
CardView cardView = (CardView) pointView.findViewById(R.id.cv_carview);
//5.0CarView 才支持设置阴影
if(Build.VERSION.SDK_INT >=21) {
cardView.setElevation(TDevice.dpToPixel(8));
}
cardViewSetBackgroundColor(point, cardView);
//如果不是无效知识点,则加入点击事件
if (point.getObjectId() != null) {
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startContentList(point);
}
});
}
pointName.setText(point.getName());
holder.ly_carview.addView(pointView);
}
}
示例10: onCreateView
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View inputFragmentView = inflater.inflate(R.layout.fragment_home, container, false);
CardView greeting = (CardView) inputFragmentView.findViewById(R.id.greeting);
greeting.setOnClickListener(
new CardView.OnClickListener(){
@Override
public void onClick(View view) {
Intent i = new Intent(getContext(), GreetingActivity.class);
startActivity(i);
}
}
);
return inputFragmentView;
}
示例11: setColor
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
private void setColor(CardView card, TextView text, int color) {
if (Color.alpha(color) == 0) {
//color not found
card.setVisibility(View.GONE);
return;
}
card.setCardBackgroundColor(color);
text.setTextColor(getTextColor(text.getContext(), color));
String colorHex = String.format("#%06X", (0xFFFFFF & color));
text.setText(colorHex);
card.setTag(colorHex);
card.setOnClickListener(onClickListener);
}
示例12: DCOralHealthItemViewHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public DCOralHealthItemViewHolder(View view) {
super(view);
sdvOralHealthItem = (SimpleDraweeView) view.findViewById(R.id.sdv_oral_health_item);
tvOralHealthItemTitle = (DCTextView) view.findViewById(R.id.tv_oral_health_item_title);
tvOralHealthDescription = (DCTextView) view.findViewById(R.id.tv_oral_health_description);
cvOralHealthItem = (CardView) view.findViewById(R.id.cv_oral_health_item);
cvOralHealthItem.setOnClickListener(this);
}
示例13: NavigationItem
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
public NavigationItem(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.NavigationItem,
defStyleAttr, defStyleRes);
String labelText = typedArray.getString(R.styleable.NavigationItem_labelText);
String infoText = typedArray.getString(R.styleable.NavigationItem_infoText);
Drawable logoDrawable = typedArray.getDrawable(R.styleable.NavigationItem_itemLogo);
@ColorRes int colorRes = typedArray.getResourceId(R.styleable.NavigationItem_imageColor, 0);
String launchingActivityName = typedArray.getString(R.styleable.NavigationItem_destinationActivityName);
int imageColor = ContextCompat.getColor(getContext(), colorRes);
typedArray.recycle();
View rootView = LayoutInflater.from(context).inflate(R.layout.navigation_item, this);
TextView buttonLabel = rootView.findViewById(R.id.buttonLabel);
buttonLabel.setText(labelText);
if (logoDrawable != null) {
Drawable mutatedLogoDrawable = logoDrawable.mutate();
mutatedLogoDrawable.setColorFilter(imageColor, PorterDuff.Mode.SRC_IN);
buttonLabel.setCompoundDrawablesRelativeWithIntrinsicBounds(mutatedLogoDrawable, null,
null, null);
}
InfoButton infoButton = rootView.findViewById(R.id.infoButton);
infoButton.setInfoText(infoText);
infoButton.setColorFilter(imageColor);
CardView outerView = rootView.findViewById(R.id.cardView);
outerView.setOnClickListener((view) -> {
if (launchingActivityName != null) {
Intent intent = new Intent();
intent.setClassName(getContext().getPackageName(), launchingActivityName);
context.startActivity(intent);
} else {
Log.w(TAG, "Launching Activity name not set.");
}
});
}
示例14: onCreate
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
mAddContact = (CardView) findViewById(R.id.add_contact);
mAddContact.setOnClickListener(this);
mPresenter = new SettingsPresenter(this);
}
示例15: SmsListItemHolder
import android.support.v7.widget.CardView; //导入方法依赖的package包/类
SmsListItemHolder(Context contextTemp, View itemView) {
super(itemView);
// 1. Set the context
context = contextTemp;
// 2. Set up the UI widgets of the holder
smsBodyTextView = (TextView) itemView.findViewById(R.id.sms_body_textview);
smsFromTextView = (TextView) itemView.findViewById(R.id.sms_from_textview);
smsTimeTextView = (TextView) itemView.findViewById(R.id.sms_time_textview);
smsCategoryButton = (Button) itemView.findViewById(R.id.bucket_button);
listItemContent = (CardView) itemView.findViewById(R.id.sms_list_item_content);
regularLayout = (RelativeLayout) itemView.findViewById(R.id.regularLayout);
swipeLayout = (LinearLayout) itemView.findViewById(R.id.swipeLayout);
undo = (TextView) itemView.findViewById(R.id.undo);
// 3. Set the "onClick" listener of the holder
itemView.setOnClickListener(this);
listItemContent.setOnClickListener(this);
smsBodyTextView.setOnClickListener(this);
}