当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setBackgroundColor方法代码示例

本文整理汇总了Java中android.widget.ImageView.setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setBackgroundColor方法的具体用法?Java ImageView.setBackgroundColor怎么用?Java ImageView.setBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.setBackgroundColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mRed = new SeekText(R.id.seek_red, R.id.txt_red, 255);
    mGreen = new SeekText(R.id.seek_green, R.id.txt_green, 255);
    mBlue = new SeekText(R.id.seek_blue, R.id.txt_blue, 255);
    mImageView = (ImageView) findViewById(R.id.img_preview);
    mImageView.setBackgroundColor(Color.argb(0, 255, 255, 255));

    mUsbManager = (UsbManager) getSystemService(USB_SERVICE);
    mPermIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);

    mUsbThread = new HandlerThread("USB Handler");
    mUsbThread.start();
    mUsbHandler = new Handler(mUsbThread.getLooper());
    mMainHandler = new Handler();
}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:20,代码来源:MainActivity.java

示例2: addDotView

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 周视图上面的小点
 *
 * @param hour
 * @param j
 */
public void addDotView(int hour, int j) {
    if (j == 7 || hour == 10) {
        return;
    }
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(DensityUtils.dp2px(context, 3),
            DensityUtils.dp2px(context, 3));
    params.topMargin = hour * gridHeight;
    params.leftMargin = aveWidth * j;

    ImageView view = new ImageView(context);
    view.setLayoutParams(params);
    view.setBackgroundColor(getResources().getColor(R.color.week_view_text_date));

    if (courseLayout != null) {
        courseLayout.addView(view);
    }

}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:25,代码来源:SyllabusFragment.java

示例3: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
public void onCreate() {
	ivViewer = new ImageView(activity);
	ivViewer.setScaleType(ScaleType.CENTER_INSIDE);
	ivViewer.setBackgroundColor(0xc0000000);
	ivViewer.setOnClickListener(this);
	activity.setContentView(ivViewer);
	if (pic != null && !pic.isRecycled()) {
		ivViewer.setImageBitmap(pic);
	}
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:11,代码来源:PicViewer.java

示例4: onCreateView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    ImageView iv = (ImageView) inflater.inflate(R.layout.tutorial_img,
            null, false);
    iv.setImageBitmap(null);
    iv.setBackgroundColor(Color.BLACK);
    iv.setImageResource(tutImgs[getArguments().getInt("indx")]);
    return iv;
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:11,代码来源:TutorialImageFragment.java

示例5: getView

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public View getView(int i, View view) {

    ImageView iv = new ImageView(context);
    iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
    iv.setBackgroundColor(Color.parseColor("#f5f5f5"));
    Picasso.with(context).load(getUrl(i)).placeholder(new ColorDrawable(Color.parseColor("#f5f5f5"))).into(iv);
    return iv;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MyOrderAdapter.java

示例6: creatImg

import android.widget.ImageView; //导入方法依赖的package包/类
ImageView creatImg(){
    ImageView top = new ImageView(getContext());
    top.setLayoutParams(new LayoutParams(width,width));
    top.setY(height - width);
    top.setBackgroundColor(0xFF999999);
    top.setScaleType(ImageView.ScaleType.CENTER_CROP);
    return top;
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:9,代码来源:imgSlider.java

示例7: loadImage

import android.widget.ImageView; //导入方法依赖的package包/类
public static void loadImage(Context context, String url, ImageView imageView) {
    // 夜间模式的处理
    if (SPUtil.getBoolean(Constants.IS_NIGHT_MODE)) {
        imageView.setAlpha(0.2f);
        imageView.setBackgroundColor(Color.BLACK);
    }
    Glide.with(context).load(url).into(imageView);
}
 
开发者ID:Jay-Ping,项目名称:newIPlay,代码行数:9,代码来源:ImageLoader.java

示例8: initThumbs

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 初始化缩略图
 */
private void initThumbs(){

    final int frame = 15;
    final int frameTime = videoDuration/frame*1000;

    int thumbnailWidth =  ll_thumbnail.getWidth()/frame;
    for (int x=0; x<frame; x++){
        ImageView imageView = new ImageView(this);
        imageView.setLayoutParams(new ViewGroup.LayoutParams(thumbnailWidth, ViewGroup.LayoutParams.MATCH_PARENT));
        imageView.setBackgroundColor(Color.parseColor("#666666"));
        imageView.setScaleType(ImageView.ScaleType.CENTER);
        ll_thumbnail.addView(imageView);
    }

    new AsyncTask<Void, Void, Boolean>() {
        @Override
        protected Boolean doInBackground(Void... params) {
            MediaMetadataRetriever mediaMetadata= new MediaMetadataRetriever();
            mediaMetadata.setDataSource(mContext, Uri.parse(path));
            for (int x=0; x<frame; x++){
                Bitmap bitmap = mediaMetadata.getFrameAtTime(frameTime*x, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
                Message msg = myHandler.obtainMessage();
                msg.obj = bitmap;
                msg.arg1 = x;
                myHandler.sendMessage(msg);
            }
            mediaMetadata.release();
            return true;
        }
        @Override
        protected void onPostExecute(Boolean result) {
        }
    }.execute();
}
 
开发者ID:Zhaoss,项目名称:WeiXinRecordedDemo,代码行数:38,代码来源:CutTimeActivity.java

示例9: songSliderThumb

import android.widget.ImageView; //导入方法依赖的package包/类
public songSliderThumb(Context context, int width, int height,int ID) {
    super(context, width, height);
    this.ID = ID;
    setBackgroundColor(0x0000000);
    //SongSliderImg = new songSliderImg(width,height,0,0);
    RaidiusSqure = new radiusSqure(width,height,0,0,width*0.1f);
    RaidiusSqure.setColor(0xFFFFFFFF);

    name = textImg.getFMText(getContext(),"DEMO", Ui.cd.getHt(16));

    back = thumbBack.getFMview(getContext(),false);
    back.setSize(width - Ui.cd.getHt(2),height - Ui.cd.getHt(2));
    back.setX(Ui.cd.getHt(1));
    back.setY(Ui.cd.getHt(1));
    back.setClickable(false);
    addView(back);

    Iv = new ImageView(context){
        @Override
        protected void onDraw(Canvas canvas) {
            canvas.clipPath(back.img.mask);
            super.onDraw(canvas);
        }
    };
    Iv.setLayoutParams(new FrameLayout.LayoutParams(width - Ui.cd.getHt(2),height - Ui.cd.getHt(2)));
     addView(Iv);
    Iv.setScaleType(ImageView.ScaleType.CENTER_CROP);
    Iv.setBackgroundColor(0x00FFFFFF);
    Iv.setX(Ui.cd.getHt(1));
    Iv.setY(Ui.cd.getHt(1));
    //setImg("3.png");

    ring = thumbRing.getFMview(getContext(),false);
    ring.setSize(width,height);
    ring.setClickable(false);
    addView(ring);
    if(android.os.Build.VERSION.SDK_INT <= 18){
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

   // addView(name);
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:43,代码来源:songSliderThumb.java

示例10: configureEditModeLogo

import android.widget.ImageView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private static void configureEditModeLogo(Resources resources, ImageView logo) {
    logo.setImageDrawable(resources.getDrawable(R.drawable.exo_edit_mode_logo));
    logo.setBackgroundColor(resources.getColor(R.color.exo_edit_mode_background_color));
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:6,代码来源:SimpleExoPlayerView.java

示例11: UploadView

import android.widget.ImageView; //导入方法依赖的package包/类
public UploadView(Context context, String uploadId, Bitmap bm, String title, String statusText, String pText, int progress) {
	super(context);
	
	idView = new TextView(context);
	idView.setVisibility(View.GONE);
	idView.setText(uploadId + "");

	imageView = new ImageView(context);
	imageView.setImageBitmap(bm);
	imageView.setBackgroundColor(0xFF666666);
	imageView.setId(VIDEOIMAGE_ID);
	
	titleView = new TextView(context);
	titleView.setText(title);
	titleView.setTextColor(0xFF000000);
	titleView.setId(TITLEVIEW_ID);
	titleView.setPaddingRelative(5, 5, 0, 0);
	
	statusTextView = new TextView(context);
	statusTextView.setText(statusText);
	statusTextView.setTextColor(0xFF000000);
	statusTextView.setId(STATUSVIEW_ID);
	statusTextView.setPaddingRelative(5, 5, 0, 0);
	statusTextView.setTextColor(Color.GRAY);
	
	progressTextView = new TextView(context);
	progressTextView.setText(pText);
	progressTextView.setTextColor(0xFF000000);
	progressTextView.setId(PROGRESSTEXT_ID);
	progressTextView.setPaddingRelative(5, 5, 0, 0);
	progressTextView.setTextColor(Color.GRAY);
	
	progressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
	progressBar.setMax(100);
	progressBar.setIndeterminate(false);
       progressBar.setProgressDrawable(getResources().getDrawable(R.drawable.progressbar));
       progressBar.setId(PROGRESSBAR_ID);
       progressBar.setPaddingRelative(5, 0, 0, 0);
       progressBar.setProgress(progress);
       
       /**
        *  
        *  + + + +  title
        *  + img +  0M / 0M
        *  +     +  下载中
        *  + + + +  ********progress**************
        *  
        * */
       //左侧
       LayoutParams imageLayoutParams = new LayoutParams(ParamsUtil.dpToPx(context, 75), ParamsUtil.dpToPx(context, 75));
	imageLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
	
	//位于图片右侧
	LayoutParams titleLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	titleLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
	
	//位于标题下方
	LayoutParams statusLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	statusLayoutParams.addRule(RelativeLayout.BELOW, TITLEVIEW_ID);
	statusLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
	
	//位于状态下方
	LayoutParams progressTextParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	progressTextParams.addRule(RelativeLayout.BELOW, STATUSVIEW_ID);
	progressTextParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
	
	//位于图片左侧,进度文本下方
       LayoutParams progressBarLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, ParamsUtil.dpToPx(context, 7));
       progressBarLayoutParams.addRule(RelativeLayout.RIGHT_OF, VIDEOIMAGE_ID);
       progressBarLayoutParams.addRule(RelativeLayout.BELOW, PROGRESSTEXT_ID);
       progressBarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
       
	addView(imageView, imageLayoutParams);
	addView(titleView, titleLayoutParams);
	addView(statusTextView, statusLayoutParams);
	addView(progressTextView, progressTextParams);
	addView(progressBar, progressBarLayoutParams);
	setPadding(5, 5, 5, 5);

}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:81,代码来源:UploadView.java

示例12: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Random random = new Random();

    switch (random.nextInt(4))
    {

        case 0:
            setFadeAnimation();
            break;
        case 1:
            setZoomAnimation();
            break;
        case 2:
            setFlowAnimation();
            break;
        case 3:
            setSlideOverAnimation();
            break;
        case 4:
            setDepthAnimation();
            break;

    }

    SliderPage sliderPage1 = new SliderPage();
    sliderPage1.setTitle("Welcome!");
    sliderPage1.setDescription("This is a demo of the AppIntro library, with a custom background on each slide!");
    sliderPage1.setImageDrawable(R.mipmap.ic_launcher);
    sliderPage1.setBgColor(Color.TRANSPARENT);
    addSlide(AppIntroFragment.newInstance(sliderPage1));

    SliderPage sliderPage2 = new SliderPage();
    sliderPage2.setTitle("Clean App Intros");
    sliderPage2.setDescription("This library offers developers the ability to add clean app intros at the start of their apps.");
    sliderPage2.setImageDrawable(R.mipmap.ic_launcher);
    sliderPage2.setBgColor(Color.TRANSPARENT);
    addSlide(AppIntroFragment.newInstance(sliderPage2));

    SliderPage sliderPage3 = new SliderPage();
    sliderPage3.setTitle("Simple, yet Customizable");
    sliderPage3.setDescription("The library offers a lot of customization, while keeping it simple for those that like simple.");
    sliderPage3.setImageDrawable(R.mipmap.ic_launcher);
    sliderPage3.setBgColor(Color.TRANSPARENT);
    addSlide(AppIntroFragment.newInstance(sliderPage3));

    SliderPage sliderPage4 = new SliderPage();
    sliderPage4.setTitle("Explore");
    sliderPage4.setDescription("Feel free to explore the rest of the library demo!");
    sliderPage4.setImageDrawable(R.mipmap.ic_launcher);
    sliderPage4.setBgColor(Color.TRANSPARENT);
    addSlide(AppIntroFragment.newInstance(sliderPage4));

    // Declare a new image view
    ImageView imageView = new ImageView(this);

    // Bind a drawable to the imageview
   // imageView.setImageResource(R.mipmap.ic_launcher);

    // Set background color
    imageView.setBackgroundColor(Color.GRAY);

    // Set layout params
    imageView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    // Bind the background to the intro
    setBackgroundView(imageView);
}
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:71,代码来源:CustomBackgroundIntro.java

示例13: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(this.getIntent() != null) {
        this._SourceUrl = this.getIntent().getStringExtra(EXTRA_IMAGE_SOURCE);
        if(this._SourceUrl != null) {
            ImageView _ImageView = new TouchImageView(this);
            _ImageView.setBackgroundColor(Color.WHITE);
            _ImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            _ImageView.setAdjustViewBounds(true);
            try {
                Customerly.get()._RemoteImageHandler.request(new IU_RemoteImageHandler.Request()
                        .fitCenter()
                        .load(this._SourceUrl)
                        .into(this, _ImageView)
                        .placeholder(R.drawable.io_customerly__pic_placeholder_fullscreen));
                super.setContentView(_ImageView);

                final ActionBar actionBar = this.getSupportActionBar();
                if (actionBar != null) {
                    String title;
                    if(Customerly.get().__PING__LAST_widget_color != 0) {
                        actionBar.setBackgroundDrawable(new ColorDrawable(Customerly.get().__PING__LAST_widget_color));
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                            this.getWindow().setStatusBarColor(IU_Utils.alterColor(Customerly.get().__PING__LAST_widget_color, 0.8f));
                        }

                        if (IU_Utils.getContrastColor(Customerly.get().__PING__LAST_widget_color) == Color.BLACK) {
                            actionBar.setHomeAsUpIndicator(R.drawable.io_customerly__ic_arrow_back_black_24dp);
                            title = String.format("<font color='#000000'>%1$s</font>", actionBar.getTitle());

                        } else {
                            actionBar.setHomeAsUpIndicator(R.drawable.io_customerly__ic_arrow_back_white_24dp);
                            title = String.format("<font color='#ffffff'>%1$s</font>", actionBar.getTitle());
                        }
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                            actionBar.setTitle(Html.fromHtml(title, 0));
                        } else {
                            //noinspection deprecation
                            actionBar.setTitle(Html.fromHtml(title));
                        }
                    }
                    actionBar.setDisplayHomeAsUpEnabled(true);
                }
                return;
            } catch (Exception glideException) {
                IEr_CustomerlyErrorHandler.sendError(IEr_CustomerlyErrorHandler.ERROR_CODE__GLIDE_ERROR, "Error during Glide loading in FullScreenImage_Activity", glideException);
            }
        }
    }
    this.finish();
}
 
开发者ID:customerly,项目名称:Customerly-Android-SDK,代码行数:53,代码来源:IAct_FullScreenImage.java

示例14: initialize

import android.widget.ImageView; //导入方法依赖的package包/类
public void initialize(Context context) {
    this.setBackgroundColor(Color.WHITE);

    final int width = 90;
    final int height = 90;
    final int margin = 13;
    final int length = PointPath.mPathColors.length;
    int left = 10;

    for (int i = 0; i < length; ++i) {
        int color = PointPath.mPathColors[i];

        ImageView imgBtn = new ImageView(context);
        if (CURRENT_TYPE == STROCK_TYPE) {
            Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
            Canvas canvas = new Canvas(bitmap);
            Paint paint = new Paint();
            paint.setColor(Color.RED);
            paint.setStrokeWidth(PointPath.mPenStrock[i]);
            canvas.drawLine(0, height, width, 0, paint);
            imgBtn.setImageBitmap(bitmap);
            imgBtn.setBackgroundColor(Color.WHITE);

        } else {
            imgBtn.setBackgroundColor(color);

        }


        imgBtn.setOnClickListener(m_clickListener);
        imgBtn.setTag(i);

        LayoutParams params = new LayoutParams(width, height);
        params.setMargins(left, 30, 0, 0);
        params.addRule(Gravity.CENTER_VERTICAL);
        left += (margin + width);

        this.addView(imgBtn, params);
    }


    // Cancel button.
    Button btnCancel = new Button(context);
    btnCancel.setText("cancel");
    btnCancel.setId(CANCEL_BUTTON_ID);
    btnCancel.setTextSize(8);
    btnCancel.setOnClickListener(m_clickListener);
    LayoutParams btnCancelparams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, height);
    btnCancelparams.addRule(Gravity.CENTER);
    left += 10;
    btnCancelparams.setMargins(left, 30, 0, 0);
    this.addView(btnCancel, btnCancelparams);
}
 
开发者ID:ShaunSheep,项目名称:ScaleSketchPadDemo,代码行数:54,代码来源:PenStrockAndColorSelect.java

示例15: configureEditModeLogoV23

import android.widget.ImageView; //导入方法依赖的package包/类
@TargetApi(23)
private static void configureEditModeLogoV23(Resources resources, ImageView logo) {
    logo.setImageDrawable(resources.getDrawable(R.drawable.exo_edit_mode_logo, null));
    logo.setBackgroundColor(resources.getColor(R.color.exo_edit_mode_background_color, null));
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:6,代码来源:TubiExoPlayerView.java


注:本文中的android.widget.ImageView.setBackgroundColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。