public void setSearchBackground(Drawable background) { searchContainer.setBackground(background); }
void setUnselectedBackground() { if (!mList.get(mIndex).isHidden()) { mView.setBackground(null); } else { mView.setBackgroundResource(R.color.disabledAppBackground); } }
int currentVersion = Build.VERSION.SDK_INT; if (currentVersion >= Build.VERSION_CODES.JELLY_BEAN){ chip.setBackground(chipDrawable); } else{ chip.setBackgroundDrawable(chipDrawable);
/** * Will reset the search background as the default for the selected style * * @param style STYLE_CARD or STYLE_BAR */ public void setCardStyle(@Style int style) { this.style = style; LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); float elevation = 0; switch (style) { case STYLE_CARD: searchContainer.setBackground(getCardStyleBackground()); bottomLine.setVisibility(View.GONE); int cardPadding = DimensUtils.convertDpToPx(CARD_PADDING, context); layoutParams.setMargins(cardPadding, cardPadding, cardPadding, cardPadding); elevation = DimensUtils.convertDpToPx(CARD_ELEVATION, context); break; case STYLE_BAR: default: searchContainer.setBackgroundColor(Color.WHITE); bottomLine.setVisibility(View.VISIBLE); break; } searchContainer.setLayoutParams(layoutParams); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { searchContainer.setElevation(elevation); } }
@Override public void run() { if (Build.VERSION.SDK_INT <= 23) mBackground.invalidateSelf(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { mFrame.setBackgroundDrawable(mBackground); } else { mFrame.setBackground(mBackground); } if (Build.VERSION.SDK_INT <= 23) mBackground.invalidateSelf(); setContainerMargins(mBackground.getBorder_width()); mFrame.post(new Runnable() { @Override public void run() { bitmap = Bitmap.createBitmap(mFrame.getWidth(), mFrame.getHeight(), Bitmap.Config.ARGB_8888); bitmapCanvas = new Canvas(bitmap); mFrame.getBackground().draw(bitmapCanvas); if (hasLegendText() || hasLegendIcon()) { eraseBitmap(bitmapCanvas, mLegendContainer); } mFrame.setBackgroundDrawable(new BitmapDrawable(bitmap)); listenToResize = true; } }); } });
private void initializeMenuline(final ViewGroup item) { item.setBackgroundColor(mItemBGColor); if (mStyle.isRoundedTabs()) { item.setBackground(mStyle.getBgDrawableFor(item, mItemBGColor)); } LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)mMain.getResources().getDimension(R.dimen.action_menu_width), ViewGroup.LayoutParams.WRAP_CONTENT); lp.setMargins(12,13,12,13); item.setLayoutParams(lp); mShortcutActionsList.addView(item); if (mAnimationDuration>0) { if (mShortcutActionsList.getChildCount() > mOldNum) { item.setVisibility(View.GONE); } item.setScaleY(.1f); item.animate() .scaleY(1f) .setDuration(mAnimationDuration) .setStartDelay(mShortcutActionsList.getChildCount() * 10 + 10) .withStartAction(new Runnable() { @Override public void run() { item.setVisibility(View.VISIBLE); } }); } }
private void getImage(){ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = null; v = inflater.inflate(R.layout.receiverlayout, null); ViewGroup vg = (ViewGroup) findViewById(R.id.yourmainlayout); Bundle bundle = getIntent().getExtras(); byte[] ba = bundle.getByteArray("myimage"); Bitmap bm = BitmapFactory.decodeByteArray(ba, 0, ba.length()); Drawable dr = new BitmapDrawable(getResources, bm); vg.setBackground(dr); vg.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); }
public void switchScreen() { if (Constants.isShowInMainSceen) { if (mPresentation != null && mPresentation.isShowing()) { mPresentation.getRootView().removeAllViews(); mPresentation.dismiss(); mPresentation = null; mDocView.refresh(); mReaderRootView.setBackground(null); mReaderRootView.addView(mReadWidget); mReaderRootView.addView(mMenuRoot); } } else { if (mPresentation == null) { mPresentation = (PdfPresentation) mvpPresenter.initPresentation(); } mDocView.refresh(); mReaderRootView.removeAllViews(); mReaderRootView.setBackgroundColor(getResources().getColor(R.color.common_black)); mPresentation.getRootView().removeAllViews(); mPresentation.getRootView().post(new Runnable() { @Override public void run() { mPresentation.getRootView().addView(mReadWidget); mPresentation.getRootView().addView(mMenuRoot); } }); } }
view.setBackground(drawable); view.setBackground(placeholder); view.setBackground(errorDrawable); view.setBackground(placeholder);
shape.setColor(peer_color_bg); textView_container.setBackground(shape);
viewGroup.setBackground(null);
Drawable bg = new BorderCropDrawable(mLauncher.getResources().getDrawable(R.drawable.cling_bg), true, true, true, false); content.setBackground(bg);
Drawable bg = new BorderCropDrawable(mLauncher.getResources().getDrawable(R.drawable.cling_bg), true, true, true, false); content.setBackground(bg);
setContentView(base); getWindow().setBackgroundDrawable(base.getBackground()); base.setBackground(null); super.onCreate(savedInstanceState);
@Override protected void onFinishInflate() { super.onFinishInflate(); mTextAndBackground = (ViewGroup) findViewById(R.id.text_and_background); ColorDrawable colorBackground = (ColorDrawable) mTextAndBackground.getBackground(); mBackgroundColor = colorBackground.getColor(); RippleDrawable rippleBackground = new RippleDrawable(ColorStateList.valueOf( ThemeUtils.getAttrColor(getContext(), android.R.attr.colorControlHighlight)), colorBackground, null); mTextAndBackground.setBackground(rippleBackground); mTitleView = (TextView) mTextAndBackground.findViewById(R.id.title); mTextView = (TextView) mTextAndBackground.findViewById(R.id.text); }
gradientDrawable.setCornerRadius(30.0f); gradientDrawable.setShape(GradientDrawable.RECTANGLE); mParent.setBackground(gradientDrawable);