当前位置: 首页>>代码示例>>Java>>正文


Java CardView.setOnClickListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:20,代码来源:EditShareMessageActivity.java

示例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);
            }
        }
    });
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:23,代码来源:PackageDetailsAdapter.java

示例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);
        }
    });
}
 
开发者ID:setakarim,项目名称:ingetin,代码行数:17,代码来源:TentangKamiActivity.java

示例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;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:about.java

示例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();
        }
    });
}
 
开发者ID:zak0,项目名称:AppTycoon,代码行数:26,代码来源:AssetsFragment.java

示例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);
        }
    });
}
 
开发者ID:hitanshu-dhawan,项目名称:PopCorn,代码行数:20,代码来源:MovieCastsOfPersonAdapter.java

示例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;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:19,代码来源:WalletAddressFragment.java

示例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);
        }
    });
}
 
开发者ID:hitanshu-dhawan,项目名称:PopCorn,代码行数:20,代码来源:TVCastsOfPersonAdapter.java

示例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);
    }
}
 
开发者ID:FallenCrood,项目名称:Review-,代码行数:25,代码来源:ReviewListAdapter.java

示例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;

}
 
开发者ID:mnirfan,项目名称:FLSGuide,代码行数:21,代码来源:HomeFragment.java

示例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);
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:16,代码来源:InfoRecyclerViewAdapter.java

示例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);
}
 
开发者ID:Dentacoin,项目名称:aftercare-app-android,代码行数:9,代码来源:DCOralHealthItemViewHolder.java

示例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.");
        }
    });
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:36,代码来源:NavigationItem.java

示例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);
}
 
开发者ID:InnoFang,项目名称:FamilyBond,代码行数:11,代码来源:SettingsActivity.java

示例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);
}
 
开发者ID:xRahul,项目名称:GroupingMessages,代码行数:23,代码来源:SmsListItemHolder.java


注:本文中的android.support.v7.widget.CardView.setOnClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。