當前位置: 首頁>>代碼示例>>Java>>正文


Java CardView類代碼示例

本文整理匯總了Java中android.support.v7.widget.CardView的典型用法代碼示例。如果您正苦於以下問題:Java CardView類的具體用法?Java CardView怎麽用?Java CardView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CardView類屬於android.support.v7.widget包,在下文中一共展示了CardView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SetThisColorToCard

import android.support.v7.widget.CardView; //導入依賴的package包/類
private void SetThisColorToCard(int id) {
    //grab all 7 cards
    CardView cardView1 = (CardView) findViewById(R.id.QA1);
    CardView cardView2 = (CardView) findViewById(R.id.QA2);
    CardView cardView3 = (CardView) findViewById(R.id.QA3);
    CardView cardView5 = (CardView) findViewById(R.id.QA5);
    CardView cardView8 = (CardView) findViewById(R.id.QA8);
    CardView cardView9 = (CardView) findViewById(R.id.QA9);
    CardView cardView10 = (CardView) findViewById(R.id.QA10);
    //set the background color
    cardView1.setCardBackgroundColor(id);
    cardView2.setCardBackgroundColor(id);
    cardView3.setCardBackgroundColor(id);
    cardView5.setCardBackgroundColor(id);
    cardView8.setCardBackgroundColor(id);
    cardView9.setCardBackgroundColor(id);
    cardView10.setCardBackgroundColor(id);
}
 
開發者ID:coder3101,項目名稱:Matrix-Calculator-for-Android,代碼行數:19,代碼來源:faqs.java

示例2: onCreate

import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_login_registration);
    login = (Button) findViewById(R.id.btn_login);
    register = (Button) findViewById(R.id.btn_register);
    cardView=(CardView)findViewById(R.id.layout2);
    splashActivity=new SplashActivity();

    login.setOnClickListener(this);
    register.setOnClickListener(this);
    b=splashActivity.containsPass("password");

    if(b==true)
    {
        register.setVisibility(View.INVISIBLE);
        cardView.setVisibility(View.INVISIBLE);
    }
}
 
開發者ID:Pritom14,項目名稱:Password-Storage,代碼行數:21,代碼來源:LoginRegistrationActivity.java

示例3: onUpdateViewAlpha

import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onUpdateViewAlpha(@NonNull View view, float alpha) {
    final CardView card = ((CardView)view);
    final View alphaView = card.getChildAt(1);
    final View imageView = card.getChildAt(0);

    final boolean isLeftCard = alpha < 1;
    if (isLeftCard) {
        ViewCompat.setAlpha(alphaView, 0.9f - alpha);
        ViewCompat.setAlpha(imageView, 0.3f + alpha);
    } else {
        if (ViewCompat.getAlpha(alphaView) != 0) {
            ViewCompat.setAlpha(alphaView, 0f);
        }

        if (ViewCompat.getAlpha(imageView) != 1) {
            ViewCompat.setAlpha(imageView, 1f);
        }
    }
}
 
開發者ID:Ramotion,項目名稱:showroom-android,代碼行數:21,代碼來源:CardsUpdater.java

示例4: HistoryViewHolders

import android.support.v7.widget.CardView; //導入依賴的package包/類
public HistoryViewHolders(int loaderId, HistoryRecyclerViewAdapter.SelectListener listener, View itemView) {
    super(itemView);
    mLoaderId = loaderId;

    itemView.setOnClickListener(this);
    itemView.setOnLongClickListener(this);
    mSeparator = (TextView) itemView.findViewById(R.id.separator);
    mStartLabel = (TextView) itemView.findViewById(R.id.start_label);
    mNoteLabel = (TextView) itemView.findViewById(R.id.note);
    mDurationLabel = (TextView) itemView.findViewById(R.id.duration_label);
    mSymbol = (ImageView) itemView.findViewById(R.id.picture);
    mActivityCardView = (CardView) itemView.findViewById(R.id.activity_card);
    mName = (TextView) itemView.findViewById(R.id.activity_name);
    mBackground = itemView.findViewById(R.id.activity_background);
    mImageRecycler = (RecyclerView)itemView.findViewById(R.id.image_grid);
    mListener = listener;
}
 
開發者ID:ramack,項目名稱:ActivityDiary,代碼行數:18,代碼來源:HistoryViewHolders.java

示例5: onBindViewHolder

import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
    if(tech.equals(GankMainFragment.tabTitle[0])) {
        ((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_android);
    } else if(tech.equals(GankMainFragment.tabTitle[1])) {
        ((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_ios);
    } else if(tech.equals(GankMainFragment.tabTitle[2])) {
        ((ViewHolder)holder).ivIcon.setImageResource(R.mipmap.ic_web);
    }
    ((ViewHolder)holder).tvContent.setText(mList.get(position).getDesc());
    ((ViewHolder)holder).tvAuthor.setText(mList.get(position).getWho());
    ((ViewHolder)holder).tvTime.setText(DateUtil.formatDateTime(DateUtil.subStandardTime(mList.get(position).getPublishedAt()), true));
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(onItemClickListener != null) {
                CardView cv = (CardView) view.findViewById(R.id.cv_tech_content);
                onItemClickListener.onItemClick(holder.getAdapterPosition(),cv);
            }
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:TechAdapter.java

示例6: animateOut

import android.support.v7.widget.CardView; //導入依賴的package包/類
private void animateOut(final CardView view) {
    if (animInProgress)
        return;
    animInProgress = true;
    view.setVisibility(View.VISIBLE);
    ViewCompat.animate(view).translationX(hiddenPosX)
            .setInterpolator(interpolator).withLayer()
            .setListener(new ViewPropertyAnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(View view1) {
                    super.onAnimationEnd(view1);
                    animInProgress = false;
                    if (currentPos > 400)
                        animateIn(view);
                    else animateOut(view);
                }
            })
            .start();
}
 
開發者ID:architjn,項目名稱:SharePanel,代碼行數:20,代碼來源:SlideHideBehaviour.java

示例7: initController

import android.support.v7.widget.CardView; //導入依賴的package包/類
private void initController(final View actionView, final TextView actionTv,
                            final AppCompatRadioButton serialRb,
                            final AppCompatRadioButton parallelRb,
                            final CardView deleteActionView, final View deleteActionTv) {
    final QueueController controller = new QueueController();
    this.controller = controller;
    controller.initTasks(this, new DownloadQueueListener() {
        @Override public void queueEnd() {
            actionView.setTag(null);
            actionTv.setText(R.string.start);
            // to cancel
            controller.stop();

            serialRb.setEnabled(true);
            parallelRb.setEnabled(true);

            deleteActionView.setEnabled(true);
            deleteActionView.setCardElevation((Float) deleteActionView.getTag());
            deleteActionTv.setEnabled(true);

            adapter.notifyDataSetChanged();
        }
    });

}
 
開發者ID:lingochamp,項目名稱:okdownload,代碼行數:26,代碼來源:QueueActivity.java

示例8: FABtoSheet

import android.support.v7.widget.CardView; //導入依賴的package包/類
public FABtoSheet(FloatingActionButton fab, CardView card) {
    this.floatingActionButton = fab;
    this.cardView = card;


    startWidth = floatingActionButton.getWidth();
    startHeight = floatingActionButton.getHeight();
    startLeft = floatingActionButton.getLeft();
    startTop = floatingActionButton.getTop();
    int startRight = floatingActionButton.getRight();
    int startBottom = floatingActionButton.getBottom();
    startRect = new Rect(startLeft, startTop, startRight, startBottom);

    endWidth = cardView.getWidth();
    endHeight = cardView.getHeight();
    endLeft = cardView.getLeft();
    endTop = cardView.getTop();
    int endRight = cardView.getRight();
    int endBottom = cardView.getBottom();
    endRect = new Rect(endLeft, endTop, endRight, endBottom);
    radius = Math.min(endWidth, endHeight)/2;
}
 
開發者ID:Sourav-21,項目名稱:MaterialDesignFABtoSheet,代碼行數:23,代碼來源:FABtoSheet.java

示例9: onSelected

import android.support.v7.widget.CardView; //導入依賴的package包/類
private boolean onSelected(CardView v) {
    AppsItemViewHolder holder = (AppsItemViewHolder) v.getTag();
    String packageName = holder.packageName;
    if (packageName == null || !mPackages.contains(packageName)) {
        return false;
    }
    if (mSelected.contains(packageName)) {
        mSelected.remove(packageName);
    } else {
        mSelected.add(packageName);
    }
    BreventActivity activity = getActivity();
    if (activity != null) {
        updateIcon(holder);
        activity.setSelectCount(mSelected.size());
    }
    return true;
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:19,代碼來源:AppsItemAdapter.java

示例10: onCreate

import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);
    userId = getIntent().getIntExtra(EXTRA_USER_ID,0);
    mToolbar = (Toolbar) findViewById(R.id.activity_profile_toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    mToolbar.setNavigationIcon(R.drawable.ic_action_back);

    mAvatarImageView = (ImageView) findViewById(R.id.activity_profile_avatar);
    mNameTextView = (TextView) findViewById(R.id.activity_profile_name);
    mBioTextView = (TextView) findViewById(R.id.activity_profile_bio);
    mValueTextView = (TextView) findViewById(R.id.activity_profile_value);
    mLocationTextView = (TextView) findViewById(R.id.activity_profile_location);
    mEditCardView = (CardView) findViewById(R.id.activity_profile_cv_edit);
    mEditButton = (Button) findViewById(R.id.activity_profile_button_edit);
    mRecyclerView = (RecyclerView) findViewById(R.id.activity_profile_recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(new NewAdapter(new ArrayList<RantItem>()));


    getData();

}
 
開發者ID:shawnsky,項目名稱:RantApp,代碼行數:26,代碼來源:ProfileActivity.java

示例11: 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

示例12: onClick

import android.support.v7.widget.CardView; //導入依賴的package包/類
@Override
public void onClick(View v) {
    fab.setSelected(false);
    removeFabMenuItems();

    if (menuListener != null) {
        if (v == this || v == touchGuard) {
            menuListener.onMenuClosed();
        } else if (v instanceof FloatingActionButton) {
            menuListener.onMenuItemSelected(fabMenuItemMap.get(v));
        } else if (v instanceof CardView) {
            menuListener.onMenuItemSelected(cardViewMenuItemMap.get(v));
        }
    } else {
        Log.d(TAG, "You haven't provided a MenuListener.");
    }
}
 
開發者ID:Alcatraz323,項目名稱:MaterialOCR,代碼行數:18,代碼來源:FabSpeedDial.java

示例13: CardViewHolder

import android.support.v7.widget.CardView; //導入依賴的package包/類
CardViewHolder(View view) {
    super(view);
    mUpFlipper = (ViewFlipper) view.findViewById(R.id.mUpFlipper);
    mDownFlipper = (ViewFlipper) view.findViewById(R.id.mDownFlipper);
    user_name = (TextView) view.findViewById(R.id.review_user_name);
    review_date = (TextView) view.findViewById(R.id.review_date);
    review_summary = (TextView) view.findViewById(R.id.review_summary);
    review_up_score = (TextView) view.findViewById(R.id.review_up_score);
    review_down_score = (TextView) view.findViewById(R.id.review_down_score);
    review_rating = (RatingBar) view.findViewById(R.id.review_rating);
    user_image = (CircleImageView) view.findViewById(R.id.review_user_image);
    review_card = (CardView) view.findViewById(R.id.card_review);
    review_read_more = (TextView) view.findViewById(R.id.review_read_more);
    /*onClickListeners*/
    user_image.setOnClickListener(this);
    review_read_more.setOnClickListener(this);
    review_card.setOnClickListener(this);
    mUpFlipper.setOnClickListener(this);
    mDownFlipper.setOnClickListener(this);
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:21,代碼來源:SeriesReviewAdapter.java

示例14: 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

示例15: initViews

import android.support.v7.widget.CardView; //導入依賴的package包/類
private void initViews(View root) {
    mOptions = (CardView) root.findViewById(R.id.options);
    mEmojiTager = (EmojiTager) root.findViewById(R.id.emoji_tager);
    mEmojiRadioAdapter = new EmojiRadioAdapter(getActivity());
    mEmojiPagerAdapter = new EmojiPagerAdapter(getActivity());
    mEmojiTager.setRadioGroupAdapter(mEmojiRadioAdapter);
    mEmojiTager.setViewPagerAdapter(mEmojiPagerAdapter);

    int height = SharePreferencesUtils.getInt(getActivity(),
            Constants.SOFT_KEYBOARD_HEIGHT, mSoftKeyboardDefaultHeight);
    mEmojiTager.getLayoutParams().height = height;
    mOptions.getLayoutParams().height = height;

    mEmojiButton = (ImageView) root.findViewById(R.id.emoji_button);

    mGifs[0] = (ImageView) root.findViewById(R.id.gif3);
    mGifs[1] = (ImageView) root.findViewById(R.id.gif1);
    mGifs[2] = (ImageView) root.findViewById(R.id.gif2);

    mShareDialog = new ShareDialog(getContext());
    mShareDialog.setEmojiAddButtonVisible(false);

    mGifSourceSpinner = (Spinner) root.findViewById(R.id.gif_source_spinner);
}
 
開發者ID:auv1107,項目名稱:TextEmoji,代碼行數:25,代碼來源:EmojiFragment.java


注:本文中的android.support.v7.widget.CardView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。