當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。