android.support.v7.widget.CardView#setCardBackgroundColor ( )源码实例Demo

下面列出了android.support.v7.widget.CardView#setCardBackgroundColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: NBAPlus   文件: RhythmAdapter.java
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    RelativeLayout relativeLayout = (RelativeLayout) this.mInflater.inflate(R.layout.adapter_rhythm_icon, null);

    //设置item布局的大小以及Y轴的位置
    relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams((int) itemWidth, mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_item_height)));
    relativeLayout.setTranslationY(itemWidth*3/7);

    //设置第二层RelativeLayout布局的宽和高
    RelativeLayout childRelativeLayout = (RelativeLayout) relativeLayout.getChildAt(0);
    CardView cardRhythm = (CardView)relativeLayout.findViewById(R.id.card_rhythm);
    TextView statName=(TextView)relativeLayout.findViewById(R.id.stat_name);
    cardRhythm.setCardBackgroundColor(mColorList[position]);
    statName.setText(sStatNames[position]);
    int relativeLayoutWidth = (int) itemWidth - 2 * mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_icon_margin);
    childRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(relativeLayoutWidth, mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_item_height) - 2 * mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_icon_margin)));
    return relativeLayout;
}
 
源代码2 项目: Birdays   文件: MonthFragmentAdapter.java
private void changeCardViewBackgroundColor(long date, CardView cardView, TextView textView) {
    String daysLeft = Utils.daysLeft(context, date);
    if (Utils.isBirthdayPassed(date)) {
        textView.setVisibility(View.GONE);
        cardView.setCardBackgroundColor(ContextCompat.getColor(context, R.color.cardview_background));
    } else {
        textView.setVisibility(View.VISIBLE);
        String today = context.getString(R.string.today);
        if (daysLeft.equals(today)) {
            cardView.setCardBackgroundColor(ContextCompat.getColor(context, R.color.cardview_birthday));
            textView.setText(today);
        } else {
            cardView.setCardBackgroundColor(ContextCompat.getColor(context, R.color.cardview_background));
            String summary = context.getString(R.string.days_left) + ": " + daysLeft;
            textView.setText(summary);
        }
    }
}
 
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);
}
 
源代码4 项目: openlauncher   文件: GroupPopupView.java
private void init() {
    if (isInEditMode()) {
        return;
    }
    _popupCard = (CardView) LayoutInflater.from(getContext()).inflate(R.layout.view_group_popup, this, false);
    // set the CardView color
    int color = Setup.appSettings().getDesktopFolderColor();
    int alpha = Color.alpha(color);
    _popupCard.setCardBackgroundColor(color);
    // remove elevation if CardView's background is transparent to avoid weird shadows because CardView does not support transparent backgrounds
    if (alpha == 0) {
        _popupCard.setCardElevation(0f);
    }
    _cellContainer = _popupCard.findViewById(R.id.group);

    bringToFront();

    setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (_dismissListener != null) {
                _dismissListener.onDismiss();
            }
            collapse();
        }
    });

    addView(_popupCard);
    _popupCard.setVisibility(View.INVISIBLE);
    setVisibility(View.INVISIBLE);

    _textViewGroupName = _popupCard.findViewById(R.id.group_popup_label);
}
 
源代码5 项目: ZhihuDaily   文件: ThemeStoriesFragment.java
@Override
public void refreshUI() {
    TypedValue itemStoryTextColor = new TypedValue();
    TypedValue itemStoryBackground = new TypedValue();
    TypedValue windowBackground = new TypedValue();
    Resources.Theme theme = getActivity().getTheme();
    theme.resolveAttribute(R.attr.item_story_text_color, itemStoryTextColor, true);
    theme.resolveAttribute(R.attr.item_story_background_color, itemStoryBackground, true);
    theme.resolveAttribute(R.attr.windowBackground, windowBackground, true);

    Resources resources = getResources();
    View window=((ViewGroup) getActivity().getWindow().getDecorView());
    window.setBackgroundColor(resources.getColor(windowBackground.resourceId));
    int childCount = recyclerView.getChildCount();
    int firstVisible = mLinearLayoutManager.findFirstVisibleItemPosition();
    for (int childIndex = 0; childIndex < childCount; childIndex++) {
        int viewType = mAdapter.getItemViewType(childIndex + firstVisible);
        switch (viewType) {
            case ThemeStoriesAdapter.Type.TYPE_HEADER:
                break;
            case ThemeStoriesAdapter.Type.TYPE_AVATARS:
                AvatarsView avatarsView = (AvatarsView) recyclerView.getChildAt(childIndex);
                avatarsView.setBackgroundColor(resources.getColor(windowBackground.resourceId));
                break;
            case ThemeStoriesAdapter.Type.TYPE_ITEM:
                CardView cardView = (CardView) recyclerView.getChildAt(childIndex);
                cardView.setCardBackgroundColor(resources.getColor(itemStoryBackground.resourceId));
                TextView title = (TextView) cardView.findViewById(R.id.title);
                title.setTextColor(resources.getColor(itemStoryTextColor.resourceId));
                break;
        }
    }
    invalidateCacheItem();
}
 
源代码6 项目: BlueBoard   文件: AcNavigationRvAdapter.java
private void setButtonInfo(ImageView imgButton, TextView tvButton, CardView cvButton, int drawable, int color, final String partitionType) {
    imgButton.setBackgroundResource(drawable);
    tvButton.setText(partitionType);
    cvButton.setCardBackgroundColor(MyApplication.getInstance().getResources().getColor(color));
    cvButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mOnClickListener.onClick(v, partitionType);
        }
    });
}
 
private void updateVisibilityFormat(ProductItem item)
{
    Resources resources = cache.getActivity().getResources();
    TextView productNameTextView = productItemCache.getProductNameTextView();
    TextView productQuantityTextView = productItemCache.getQuantityTextView();
    TextView quantityTextView = productItemCache.getQuantityTextView();
    CardView productCard = productItemCache.getProductCard();
    AppCompatCheckBox checkbox = (AppCompatCheckBox) productItemCache.getCheckbox();

    if ( item.isChecked() )
    {
        int grey = resources.getColor(R.color.middlegrey);
        productCard.setCardBackgroundColor(resources.getColor(R.color.transparent));
        checkbox.setSupportButtonTintList(ColorStateList.valueOf(resources.getColor(R.color.middleblue)));
        productNameTextView.setTextColor(grey);
        quantityTextView.setTextColor(grey);
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    }
    else
    {
        int black = resources.getColor(R.color.black);
        productCard.setCardBackgroundColor(resources.getColor(R.color.white));
        checkbox.setSupportButtonTintList(ColorStateList.valueOf(resources.getColor(R.color.colorAccent)));
        productNameTextView.setTextColor(black);
        quantityTextView.setTextColor(black);
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }

}
 
源代码8 项目: C9MJ   文件: ExploreSelectedTitleListAdapter.java
@Override
protected void convert(BaseViewHolder viewHolder, String title) {
    viewHolder.setText(R.id.tv_title, title)
            .setTextColor(R.id.tv_title, ContextCompat.getColor(mContext, R.color.color_icons))
            .addOnClickListener(R.id.cardview);
    CardView cardView = viewHolder.getView(R.id.cardview);
    cardView.setCardBackgroundColor(ContextCompat.getColor(mContext, R.color.color_primary));
}
 
源代码9 项目: AndroidReview   文件: ReviewListAdapter.java
private void cardViewSetBackgroundColor(Point point, CardView cardView) {
    switch (point.getColor()) {
        case NO_CONTENT:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.carview_no_content));
            break;
        case BROWN:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.brown_500));
            break;
        case DEEP_ORANGE:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.deep_orange_900));
            break;
        case ORANGE:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.orange_900));
            break;
        case GREEN:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.green));
            break;
        case LIGHT_BLUE:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.light_blue_900));
            break;
        case RED:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.red_900));
            break;
        case PINK:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.pink_600));
            break;
        case PURPLE:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.purple_800));
            break;
        default:
            cardView.setCardBackgroundColor(mContext.getResources().getColor(R.color.theme_color_level2));
            break;
    }
}
 
源代码10 项目: PowerFileExplorer   文件: ProcessViewer.java
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      rootView = inflater.inflate(R.layout.processparent, container, false);
      setRetainInstance(false);
setStyle(DialogFragment.STYLE_NO_TITLE, 0);
      mainActivity = (ExplorerActivity) getActivity();

      ColorPreference colorPreference = mainActivity.getColorPreference();
accentColor = colorPreference.getColor(ColorUsage.ACCENT);
      primaryColor = colorPreference.getColor(ColorUsage.PRIMARY);
      if (mainActivity.getAppTheme().equals(AppTheme.DARK))
          rootView.setBackgroundResource((R.color.cardView_background));
      //mainActivity.updateViews(new ColorDrawable(primaryColor));
      //mainActivity.getAppbar().setTitle(getResources().getString(R.string.process_viewer));
      //mainActivity.floatingActionButton.hideMenuButton(true);
      //sharedPrefs = PreferenceManager.getDefaultSharedPreferences(mainActivity);
      //mainActivity.supportInvalidateOptionsMenu();

      mCardView = (CardView) rootView.findViewById(R.id.card_view);

      mLineChart = (LineChart) rootView.findViewById(R.id.progress_chart);
      mProgressImage = (ImageView) rootView.findViewById(R.id.progress_image);
      mCancelButton = (ImageButton) rootView.findViewById(R.id.delete_button);
      mProgressTypeText = (TextView) rootView.findViewById(R.id.text_view_progress_type);
      mProgressFileNameText = (TextView) rootView.findViewById(R.id.text_view_progress_file_name);
      mProgressBytesText = (TextView) rootView.findViewById(R.id.text_view_progress_bytes);
      mProgressFileText = (TextView) rootView.findViewById(R.id.text_view_progress_file);
      mProgressSpeedText = (TextView) rootView.findViewById(R.id.text_view_progress_speed);
      mProgressTimer = (TextView) rootView.findViewById(R.id.text_view_progress_timer);
mProgressTypeText.setTextColor(accentColor);
      if (!copyCancelled) {
	mCancelButton.setEnabled(true);
}
if (mainActivity.getAppTheme().equals(AppTheme.DARK)) {
          mCancelButton.setImageResource(R.drawable.ic_action_cancel);
          mCardView.setCardBackgroundColor(Utils.getColor(getContext(), R.color.cardView_foreground));
          mCardView.setCardElevation(0f);
      }

      return rootView;
  }
 
@SuppressLint("ResourceAsColor")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle bundle = getArguments();

    title = bundle.getString(FANCY_PAGE_TITLE, null);
    titleResId = bundle.getInt(FANCY_PAGE_TITLE_RES_ID, 0);
    titleColor = bundle.getInt(FANCY_PAGE_TITLE_COLOR, 0);
    titleTextSize = bundle.getFloat(FANCY_PAGE_TITLE_TEXT_SIZE, 0f);
    description = bundle.getString(FANCY_PAGE_DESCRIPTION, null);
    descriptionResId = bundle.getInt(FANCY_PAGE_DESCRIPTION_RES_ID, 0);
    descriptionColor = bundle.getInt(FANCY_PAGE_DESCRIPTION_COLOR, 0);
    descriptionTextSize = bundle.getFloat(FANCY_PAGE_DESCRIPTION_TEXT_SIZE, 0f);
    imageResId = bundle.getInt(FANCY_PAGE_IMAGE_RES_ID, 0);
    backgroundColor = bundle.getInt(FANCY_PAGE_BACKGROUND_COLOR, 0);
    iconWidth = bundle.getInt(FANCY_PAGE_ICON_WIDTH, (int) dpToPixels(128, getActivity()));
    iconHeight = bundle.getInt(FANCY_PAGE_ICON_HEIGHT, (int) dpToPixels(128, getActivity()));
    marginTop = bundle.getInt(FANCY_PAGE_MARGIN_TOP, (int) dpToPixels(80, getActivity()));
    marginBottom = bundle.getInt(FANCY_PAGE_MARGIN_BOTTOM, (int) dpToPixels(0, getActivity()));
    marginLeft = bundle.getInt(FANCY_PAGE_MARGIN_LEFT, (int) dpToPixels(0, getActivity()));
    marginRight = bundle.getInt(FANCY_PAGE_MARGIN_RIGHT, (int) dpToPixels(0, getActivity()));

    view = inflater.inflate(R.layout.fragment_ahoy, container, false);
    ivOnboarderImage = (ImageView) view.findViewById(R.id.iv_image);
    tvOnboarderTitle = (TextView) view.findViewById(R.id.tv_title);
    tvOnboarderDescription = (TextView) view.findViewById(R.id.tv_description);
    cardView = (CardView) view.findViewById(R.id.cv_cardview);
    view1 = (View) view.findViewById(R.id.view1);


    if (title != null) {
        tvOnboarderTitle.setText(title);
    }

    if (titleResId != 0) {
        tvOnboarderTitle.setText(getResources().getString(titleResId));
    }

    if (description != null) {
        tvOnboarderDescription.setText(description);
    }

    if (descriptionResId != 0) {
        tvOnboarderDescription.setText(getResources().getString(descriptionResId));
    }

    if (titleColor != 0) {
        tvOnboarderTitle.setTextColor(ContextCompat.getColor(getActivity(), titleColor));
    }

    if (descriptionColor != 0) {
        tvOnboarderDescription.setTextColor(ContextCompat.getColor(getActivity(), descriptionColor));
    }

    if (imageResId != 0) {
           ivOnboarderImage.setImageDrawable(ContextCompat.getDrawable(getActivity(), imageResId));
    }

    if (titleTextSize != 0f) {
        tvOnboarderTitle.setTextSize(titleTextSize);
    }

    if (descriptionTextSize != 0f) {
        tvOnboarderDescription.setTextSize(descriptionTextSize);
    }

    if (backgroundColor != 0) {
        cardView.setCardBackgroundColor(ContextCompat.getColor(getActivity(), R.color.colorTransparent));
        GradientDrawable bgShape = (GradientDrawable) view1.getBackground();
        bgShape.setColor(ContextCompat.getColor(getActivity(), backgroundColor));

    }

    if (iconWidth != 0 && iconHeight != 0) {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(iconWidth, iconHeight);
        layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
        layoutParams.setMargins(marginLeft, marginTop, marginRight, marginBottom);
        ivOnboarderImage.setLayoutParams(layoutParams);
    }

    return view;
}
 
源代码12 项目: Android-Material-Icons   文件: Adapter.java
private void setCardViewSelected(CardView cardView, boolean selected) {
    cardView.setCardBackgroundColor(selected ? mSelectedCardColor : Color.WHITE);
}
 
源代码13 项目: C9MJ   文件: ExploreFragment.java
@Override
public void onItemDragEnd(RecyclerView.ViewHolder viewHolder, int pos) {
    BaseViewHolder holder = (BaseViewHolder) viewHolder;
    CardView cardView = holder.getView(R.id.cardview);
    cardView.setCardBackgroundColor(ContextCompat.getColor(context, R.color.color_primary));
}
 
源代码14 项目: iGap-Android   文件: CardsFragment.java
private void addEmptyCard() {
    Context context = getContext();
    int dp8 = RaadCommonUtils.getPx(8, context);
    int dp16 = RaadCommonUtils.getPx(16, context);

    int cardHeight = BankCardView.getDefaultCardHeight(getContext());

    CardView cardView = new CardView(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, cardHeight);
    params.setMargins(dp16, 0, dp16, dp16);
    cardView.setLayoutParams(params);
    if (WalletActivity.isDarkTheme) {
        cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme_2));
    } else {
        cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme));
    }

    cardView.setPreventCornerOverlap(false);
    cardView.setCardElevation(RaadCommonUtils.getPx(6, context));
    cardView.setRadius(RaadCommonUtils.getPx(8, context));
    cardsLayout.addView(cardView);
    viewItems.add(cardView);

    TextView textView = new TextView(context);
    CardView.LayoutParams textViewParams = new CardView.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    textViewParams.gravity = Gravity.CENTER;
    textView.setLayoutParams(textViewParams);
    textView.setGravity(Gravity.CENTER);
    textView.setTextColor(Color.parseColor(WalletActivity.textTitleTheme));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    textView.setTypeface(Typefaces.get(context, Typefaces.IRAN_YEKAN_REGULAR));
    textView.setText(R.string.click_here_for_adding_card);
    cardView.addView(textView);

    cardView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((NavigationBarActivity) getActivity()).pushFullFragment(
                    new AddCardFragment(), "AddCardFragment");
        }
    });
}
 
源代码15 项目: PopMenuLayout   文件: PopMenuView.java
private void init(Context context){
    mMenus = new ArrayList<MenuBean>();
    mMenuAdapter = new MenuAdapter(mContext, mMenus, mLayoutManagerOrientation);
    mMenuAdapter.setMenuWidth(mWidth);
    mMenuAdapter.setTextPaddingLeft(mMenuTextPaddingLeft);
    mMenuAdapter.setTextPaddingBottom(mMenuTextPaddingBottom);
    mMenuAdapter.setTextPaddingRight(mMenuTextPaddingRight);
    mMenuAdapter.setTextPaddingTop(mMenuTextPaddingTop);
    mMenuAdapter.setDividerDp(mMenuDividerDp);
    mMenuAdapter.setDividerColor(mDividerColor);
    mMenuAdapter.setExpandableIcon(mExpandableIcon);
    mMenuAdapter.setMenuTextColor(mMenuTextColor);
    mMenuAdapter.setHorizontalMenuBackgroundRes(mHorizontalMenuBackgroundRes);
    mMenuAdapter.setVerticalMenuBackgroundRes(mVerticalMenuBackgroundRes);
    mMenuAdapter.setMenuTextSize(mMenuTextSize);
    mMenuAdapter.setOnMenuClickListener(new OnMenuClickListener() {
        @Override
        public void onMenuClick(int level1Index, int level2Index, int level3Index) {
            dealMenuClickEvent(level1Index, level2Index, level3Index);
        }
    });
    mLayoutManager = new LinearLayoutManager(mContext);
    mLayoutManager.setOrientation(mLayoutManagerOrientation);

    mRootView = LayoutInflater.from(mContext).inflate(R.layout.view_menu_container, null);
    mCardView = (CardView) mRootView.findViewById(R.id.cardView);
    mCardView.setCardBackgroundColor(mMenuLayoutBgColor);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mCardView.getLayoutParams();
    if (mWidth != -1){
        params.width = mWidth;
    }
    if (mHeight != -1){
        params.height = mHeight;
    }
    mCardView.setLayoutParams(params);

    mRecyclerView = (RecyclerView) mRootView.findViewById(R.id.recyclerView);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setAdapter(mMenuAdapter);

    setContentView(mRootView);
    setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT);
    setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT);
    setFocusable(true);
    setAnimationStyle(mAnimStyle);
    setBackgroundDrawable(new ColorDrawable(0x00000000));
}
 
源代码16 项目: BaseProject   文件: MainActivity.java
@Override
public void onUpdate(BaseAdapterHelper helper, Demo item, int position) {
    final CardView cardView = helper.getView(R.id.main_item_cardview);
    cardView.setCardBackgroundColor(item.bgColor);
    helper.setText(R.id.main_item_tv, item.title);
}
 
源代码17 项目: AndroidBasicProject   文件: MainActivity.java
@Override public void onUpdate(BaseAdapterHelper helper, Demo item, int position) {
    final CardView cardView = helper.getView(R.id.main_item_cardview);
    cardView.setCardBackgroundColor(item.bgColor);
    helper.setText(R.id.main_item_tv, item.title);
}
 
源代码18 项目: NightOwl   文件: CardViewHandler.java
@Override
public void draw(@NonNull View view, @NonNull Object value) {
    CardView cardView = (CardView) view;
    cardView.setCardBackgroundColor((Integer) value);
}
 
源代码19 项目: fab-speed-dial   文件: FabSpeedDial.java
private View createFabMenuItem(MenuItem menuItem) {
    ViewGroup fabMenuItem = (ViewGroup) LayoutInflater.from(getContext())
            .inflate(getMenuItemLayoutId(), this, false);

    FloatingActionButton miniFab = (FloatingActionButton) fabMenuItem.findViewById(R.id.mini_fab);
    CardView cardView = (CardView) fabMenuItem.findViewById(R.id.card_view);
    TextView titleView = (TextView) fabMenuItem.findViewById(R.id.title_view);

    fabMenuItemMap.put(miniFab, menuItem);
    cardViewMenuItemMap.put(cardView, menuItem);

    miniFab.setImageDrawable(menuItem.getIcon());
    miniFab.setOnClickListener(this);
    cardView.setOnClickListener(this);

    ViewCompat.setAlpha(miniFab, 0f);
    ViewCompat.setAlpha(cardView, 0f);

    final CharSequence title = menuItem.getTitle();
    if (!TextUtils.isEmpty(title) && miniFabTitlesEnabled) {
        cardView.setCardBackgroundColor(miniFabTitleBackgroundTint.getDefaultColor());
        titleView.setText(title);
        titleView.setTypeface(null, Typeface.BOLD);
        titleView.setTextColor(miniFabTitleTextColor);

        if (miniFabTitleTextColorArray != null) {
            titleView.setTextColor(ContextCompat.getColorStateList(getContext(),
                    miniFabTitleTextColorArray[menuItem.getOrder()]));
        }
    } else {
        fabMenuItem.removeView(cardView);
    }

    miniFab.setBackgroundTintList(miniFabBackgroundTint);

    if (miniFabBackgroundTintArray != null) {
        miniFab.setBackgroundTintList(ContextCompat.getColorStateList(getContext(),
                miniFabBackgroundTintArray[menuItem.getOrder()]));
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        miniFab.setImageTintList(miniFabDrawableTint);
    }

    return fabMenuItem;
}
 
源代码20 项目: CanDialog   文件: CanDialog.java
public void setBackgroundColor(int color) {

        CardView cardView = (CardView) findViewById(R.id.card);
        cardView.setCardBackgroundColor(color);


    }