View setBackgroundColor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for View setBackgroundColor method.

This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, setVisibility, addView, addContentView
This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, addView, setOrientation
        		ViewGroup.LayoutParams.FILL_PARENT, 0.0F);
          
        LinearLayout.LayoutParams webviewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
        		ViewGroup.LayoutParams.FILL_PARENT, 1.0F);
         
        root = new LinearLayout(this);
        root.setOrientation(LinearLayout.VERTICAL);
        root.setBackgroundColor(Color.BLACK);
        root.setLayoutParams(containerParams);
                 
        appView = new WebView(this);
        appView.setLayoutParams(webviewParams);
         
        WebViewReflect.checkCompatibility(); 
         
        /* This changes the setWebChromeClient to log alerts to LogCat!  Important for Javascript Debugging */        
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ECLAIR)
        	appView.setWebChromeClient(new EclairClient(this));        	
        else 
        	appView.setWebChromeClient(new GapClient(this));

9
CodeRank
This code example shows how to use the following methods:setBackgroundColor, addView
public class MoreNinePatchesActivity extends Activity {
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         
        FrameLayout layout = new FrameLayout(this);
        PatchView b = new PatchView (this);
        b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
                FrameLayout.LayoutParams.MATCH_PARENT, Gravity.CENTER));
        layout.addView(b);
        layout.setBackgroundColor(0xffffffff);
         
        setContentView(layout);
    } 
 
    private class PatchView extends View {
        private final Drawable mDrawable1;
        private final Drawable mDrawable2;
        private final Drawable mDrawable3;
 
8
CodeRank
This code example shows how to use the following methods:setBackgroundColor
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		if (savedInstanceState != null)
			mColorRes = savedInstanceState.getInt("mColorRes");
		int color = getResources().getColor(mColorRes);
		// construct the RelativeLayout 
		RelativeLayout v = new RelativeLayout(getActivity());
		v.setBackgroundColor(color);		
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
8
CodeRank
This code example shows how to use the following methods:setAlpha, setBackgroundColor, setImageBitmap
This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, setScrollContainer, addView, setFillViewport
7
CodeRank
This code example shows how to use the following methods:setBackgroundColor, addView, setContentView, setGravity
  protected AndroidPlatform platform() { 
    return platform;
  } 
 
  protected void setContentView(GameViewGL view) {
    LinearLayout layout = new LinearLayout(this);
    layout.setBackgroundColor(0xFF000000);
    layout.setGravity(Gravity.CENTER);
    layout.addView(gameView);
    LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    getWindow().setContentView(layout, params);
  } 
} 
8
CodeRank
This code example shows how to use the following methods:setBackgroundColor, setPadding, setImageBitmap
 
        v.setDrawingCacheEnabled(true);
        mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache());
        v.setDrawingCacheEnabled(false);
 
        ImageView iv = new ImageView(mListView.getContext());
        iv.setBackgroundColor(mFloatBGColor);
        iv.setPadding(0, 0, 0, 0);
        iv.setImageBitmap(mFloatBitmap);
 
        return iv;
    } 
 
    /** 
     * Removes the Bitmap from the ImageView created in onCreateFloatView() and 
     * tells the system to recycle it. 
     */ 
    @Override 
    public void onDestroyFloatView(View floatView) {
        ((ImageView)floatView).setImageDrawable(null);
7
CodeRank
This code example shows how to use the following methods:setBackgroundColor, setImageResource, setScaleType
     * Display the thumbnail from a resource. 
     * 
     * @param resId Resource ID of the drawable to show. 
     */ 
    public void displayThumbnail(int resId) {
        mThumbnailView.setScaleType(ScaleType.CENTER);
        mThumbnailView.setImageResource(resId);
        mThumbnailView.setBackgroundColor(0x0);
    } 
 
    /** 
     * Display the thumbnail from a bitmap. 
     * 
     * @param thumbnail The bitmap to show as thumbnail. 
     */ 
    public void displayThumbnail(Bitmap thumbnail) {
        if (thumbnail == null) {
            // Show a favicon based view instead. 
            displayThumbnail(R.drawable.favicon); 
            return; 
7
CodeRank
This code example shows how to use the following methods:setBackgroundColor, setLayoutParams, setScaleType
 
    public void onNothingSelected(AdapterView<?> parent) {
    } 
 
    public View makeView() {
        ImageView i = new ImageView(this);
        i.setBackgroundColor(0xFF000000);
        i.setScaleType(ImageView.ScaleType.FIT_CENTER);
        i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT));
        return i;
    } 
 
    private ImageSwitcher mSwitcher;
 
    public class ImageAdapter extends BaseAdapter {
        public ImageAdapter(Context c) {
            mContext = c;
        } 
 
8
CodeRank

Related View setBackgroundColor Questions & Answers:

setBackgroundColor Method Overview
Sets the background color for this view.
See Code Examples for other Android View Methods: