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


Java ImageView.getBackground方法代码示例

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


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

示例1: onCreate

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

    airConditionings = new ArrayList<>();
    litersMinutes = new ArrayList<>();

    image = (ImageView) findViewById(R.id.loading);
    image.setBackgroundResource(R.drawable.loading);
    AnimationDrawable load = (AnimationDrawable) image.getBackground();
    load.start();

    new Handler().postDelayed(this, 2000);
}
 
开发者ID:mrh3nry,项目名称:Celebino,代码行数:17,代码来源:SplashActivity.java

示例2: setKeyColorRecursive

import android.widget.ImageView; //导入方法依赖的package包/类
private static void setKeyColorRecursive(ViewGroup vg) {
    if (vg == null) return;
    final int childCount = vg.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = vg.getChildAt(i);
        if (child instanceof ViewGroup) {
            setKeyColorRecursive((ViewGroup) child);
        } else if (child instanceof ImageView) {
            ImageView imgv = (ImageView) vg.getChildAt(i);
            if (mNavbarColorsEnabled) {
                imgv.setColorFilter(mKeyColor, PorterDuff.Mode.SRC_ATOP);
            } else {
                imgv.clearColorFilter();
            }
            if (imgv.getClass().getName().equals(CLASS_KEY_BUTTON_VIEW) &&
                    !mNavbarColorsEnabled) {
                Drawable ripple = imgv.getBackground();
                if (ripple != null &&
                        ripple.getClass().getName().equals(CLASS_KEY_BUTTON_RIPPLE)) {
                    Paint paint = (Paint) XposedHelpers.getObjectField(ripple, "mRipplePaint");
                    if (paint != null) {
                        paint.setColor(0xffffffff);
                    }
                }
            } else if (imgv instanceof KeyButtonView) {
                ((KeyButtonView) imgv).setGlowColor(mNavbarColorsEnabled ?
                        mKeyGlowColor : mKeyDefaultGlowColor);
            }
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:32,代码来源:ModNavigationBar.java

示例3: initViews

import android.widget.ImageView; //导入方法依赖的package包/类
private void initViews() {
    mPlayingMatrix = (ImageView) findViewById(R.id.iv_now_playing_matrix);
    AnimationDrawable animationDrawable = (AnimationDrawable) mPlayingMatrix.getBackground();
    animationDrawable.start();
    mSongName = (TextView) findViewById(R.id.tv_now_playing_song_name);
    mArtist = (TextView) findViewById(R.id.tv_now_playing_singer);
    mCurrentPosition = (TextView) findViewById(R.id.tv_now_playing_time);
    mAudioSkb = (SeekBar) findViewById(R.id.sb_audio);
    mPlayModeBtn = (Button) findViewById(R.id.btn_audio_playmode);
    mPreBtn = (Button) findViewById(R.id.btn_audio_previous);
    mPlayPauseBtn = (Button) findViewById(R.id.btn_audio_playing_pause);
    mNextBtn = (Button) findViewById(R.id.btn_audio_next);
    mLyricBtn = (Button) findViewById(R.id.btn_audio_lyrc);
    mPlayModeBtn.setOnClickListener(mClickListener);
    mPreBtn.setOnClickListener(mClickListener);
    mPlayPauseBtn.setOnClickListener(mClickListener);
    mNextBtn.setOnClickListener(mClickListener);
    mLyricBtn.setOnClickListener(mClickListener);
    mLyricShowView = (LyricShowView) findViewById(R.id.lyric_view);
    mAudioSkb.setOnSeekBarChangeListener(new AudioSeekChangeListener());
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:22,代码来源:AudioPlayerActivity.java

示例4: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle(title);
    infoText = (TextView) findViewById(R.id.infoView);
    imgView = (ImageView) findViewById(R.id.cardbg);
    imgView.setBackgroundResource(R.drawable.myanim);
    _animation = (AnimationDrawable) imgView.getBackground();
    _animation.setOneShot(false);
    uiHandler = new MyHandler(this);

    mBluetoothReader = new BluetoothReader();
    mBluetoothReader.setOnReaderStateListener(new BluetoothReader.OnReaderStateListener() {
        @Override
        public void onReaderStateChange(String readerName, int readerState) {
            if (readerName.isEmpty() == false) {
                uiHandler.obtainMessage(READER_MESSAGE, readerState, -1, readerName).sendToTarget();
            }
        }
    });

    View scan = findViewById(R.id.btScan);
    scan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            infoText.setText("Select bluetooth reader for connect...");
            Intent serverIntent = new Intent(TestActivity3.this, DeviceListActivity.class);
            startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
        }
    });
}
 
开发者ID:NaOHAndroid,项目名称:Logistics-guard,代码行数:33,代码来源:TestActivity3.java

示例5: onWindowFocusChanged

import android.widget.ImageView; //导入方法依赖的package包/类
public void onWindowFocusChanged(boolean hasFocus){
	if (progressDialog == null){
		return;
	}
	
    ImageView imageView = (ImageView) progressDialog.findViewById(R.id.loadingImageView);
    AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
    animationDrawable.start();
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:10,代码来源:ShowProgressDialog.java

示例6: showHelpOverlay

import android.widget.ImageView; //导入方法依赖的package包/类
private void showHelpOverlay(View controllerView) {
    View overlay = controllerView.findViewById(R.id.help_overlay);
    if(overlay!=null){
        overlay.setAlpha(0);
        overlay.setVisibility(View.VISIBLE);
        overlay.animate().alpha(1);
        ImageView icon = (ImageView)overlay.findViewById(R.id.up_arrow_image);
        if (icon.getBackground() instanceof AnimationDrawable) {
            ((AnimationDrawable)icon.getBackground()).start();
        }
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:13,代码来源:PlayerController.java

示例7: onWindowFocusChanged

import android.widget.ImageView; //导入方法依赖的package包/类
public void onWindowFocusChanged(boolean hasFocus) {
        ImageView imageView = (ImageView) findViewById(ResourceUtils.getIdByName(getContext(), "id", "loadingImageView"));
        AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();
        animationDrawable.start();

//        GifView image_view = (GifView) findViewById(R.id.loadingImageView);
//        image_view.setGifImageType(GifImageType.COVER);
//        image_view.setGifImage(R.drawable.loading);
    }
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:10,代码来源:SobotLoadingDialog.java

示例8: doOnViewCreated

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    speakerLevel = (ImageView) v
            .findViewById(R.id.speaker_shield_imageview);
    femaleBtn = (Button) v.findViewById(R.id.increaseBtn);
    maleBtn = (Button) v.findViewById(R.id.decreaseBtn);
    ttsText = (OneSheeldTextView) v.findViewById(R.id.ttsText);
    ttsText.setMovementMethod(new ScrollingMovementMethod());
    animation = (AnimationDrawable) speakerLevel.getBackground();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:11,代码来源:TextToSpeechFragment.java

示例9: onWindowFocusChanged

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    ImageView imageViewAnimTop = (ImageView) findViewById(R.id.imageView_animation_top);
    ImageView imageViewAnimBottom = (ImageView) findViewById(R.id.imageView_animation_bottom);

    AnimationDrawable animTop = (AnimationDrawable) imageViewAnimTop.getBackground();
    AnimationDrawable animBottom = (AnimationDrawable) imageViewAnimBottom.getBackground();

    animTop.start();
    animBottom.start();

    super.onWindowFocusChanged(hasFocus);
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:14,代码来源:CompareActivity.java

示例10: onWindowFocusChanged

import android.widget.ImageView; //导入方法依赖的package包/类
public void onWindowFocusChanged(boolean hasFocus) {

		if (customProgressDialog == null) {
			return;
		}

		ImageView imageView = (ImageView) customProgressDialog
				.findViewById(R.id.loadingImageView);
		AnimationDrawable animationDrawable = (AnimationDrawable) imageView
				.getBackground();
		animationDrawable.start();
	}
 
开发者ID:longtaoge,项目名称:SelectName,代码行数:13,代码来源:ProgressDialog.java

示例11: showLoadDialog

import android.widget.ImageView; //导入方法依赖的package包/类
public static void showLoadDialog(Context context, String text) {
    alertDialog = new AlertDialog.Builder(context).create();
    alertDialog.show();
    Window window = alertDialog.getWindow();
    window.setContentView(R.layout.dialog_loading);
    ImageView iv = (ImageView) window.findViewById(R.id.dialog_iv);
    TextView tv = (TextView) window.findViewById(R.id.dialog_tv);
    tv.setText(text);
    AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
    anim.start();
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:12,代码来源:DialogUtils.java

示例12: onClick

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onClick(final View v) {

    if (currentLookForWid.getText().equals(" ")) {
        v.startAnimation(notItAnim);
        return;
    }

    String symv = (String)v.getTag();

    TextView wid2 = activeSyms.get(current);
    if (wid2==null) return;

    String symw = (String)wid2.getTag();

    if (symv.equals(symw)) {

        Log.d("Doda", "Found " + symv.codePointAt(0));
        v.setAlpha(.6f);
        v.startAnimation(wasItAnim);


        final ImageView blow = new ImageView(this);
        blow.setBackgroundResource(R.drawable.explosion);

        Point location = symPoints.get((TextView)v);
        float fac = 1.25f;

        score += Math.max(100, 5000 - (System.currentTimeMillis() - findTime)) * (backgroundImage?1.5:1);

        int msize = spToPx((int)(mMode.getMaxIconSize(bsize)*fac));
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(msize, msize);
        lp.setMargins(location.x - (int)(mMode.getMaxIconSize(bsize)*fac/2), location.y - (int)(mMode.getMaxIconSize(bsize)*fac/2), 0, 0);
        lp.gravity = Gravity.START | Gravity.TOP;


        blow.setLayoutParams(lp);
        mSoundEffects.playPlode();

        v.clearAnimation();

        mMainScreen.removeView(v);
        activeSyms.set(current, null);
        mMainScreen.addView(blow);

        AnimationDrawable ad = ((AnimationDrawable) blow.getBackground());
        int time = ad.getNumberOfFrames() * ad.getDuration(0);
        ad.start();
        showNext(false);

        mMainScreen.postDelayed(new Runnable() {
            @Override
            public void run() {
                mMainScreen.removeView(blow);
            }
        }, time + 20);

    } else {

        v.startAnimation(notItAnim);
        if (mMode.isTimed()) {
            startTime -= 5000;
            showMessage(getString(R.string.miss_penalty));
        }

    }

}
 
开发者ID:quaap,项目名称:DodaTheExploda,代码行数:69,代码来源:MainActivity.java

示例13: onCaptureSharedElementSnapshot

import android.widget.ImageView; //导入方法依赖的package包/类
public Parcelable onCaptureSharedElementSnapshot(View sharedElement, Matrix viewToGlobalMatrix, RectF screenBounds) {
    Bitmap bitmap;
    if (sharedElement instanceof ImageView) {
        ImageView imageView = (ImageView) sharedElement;
        Drawable d = imageView.getDrawable();
        Drawable bg = imageView.getBackground();
        if (d != null && bg == null) {
            bitmap = createDrawableBitmap(d);
            if (bitmap != null) {
                Bundle bundle = new Bundle();
                bundle.putParcelable(BUNDLE_SNAPSHOT_BITMAP, bitmap);
                bundle.putString(BUNDLE_SNAPSHOT_IMAGE_SCALETYPE, imageView.getScaleType().toString());
                if (imageView.getScaleType() != ScaleType.MATRIX) {
                    return bundle;
                }
                float[] values = new float[9];
                imageView.getImageMatrix().getValues(values);
                bundle.putFloatArray(BUNDLE_SNAPSHOT_IMAGE_MATRIX, values);
                return bundle;
            }
        }
    }
    int bitmapWidth = Math.round(screenBounds.width());
    int bitmapHeight = Math.round(screenBounds.height());
    bitmap = null;
    if (bitmapWidth > 0 && bitmapHeight > 0) {
        float scale = Math.min(1.0f, ((float) MAX_IMAGE_SIZE) / ((float) (bitmapWidth * bitmapHeight)));
        bitmapWidth = (int) (((float) bitmapWidth) * scale);
        bitmapHeight = (int) (((float) bitmapHeight) * scale);
        if (this.mTempMatrix == null) {
            this.mTempMatrix = new Matrix();
        }
        this.mTempMatrix.set(viewToGlobalMatrix);
        this.mTempMatrix.postTranslate(-screenBounds.left, -screenBounds.top);
        this.mTempMatrix.postScale(scale, scale);
        bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.concat(this.mTempMatrix);
        sharedElement.draw(canvas);
    }
    return bitmap;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:43,代码来源:SharedElementCallback.java

示例14: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.productions);

  mediaPlayer = MediaPlayer.create(this, R.raw.title);
  mediaPlayer.setLooping(true);
  mediaPlayer.start();

  final ImageView splashImageView = (ImageView) findViewById(R.id.SplashImageView);
  splashImageView.setBackgroundResource(R.drawable.productiongif);
  final AnimationDrawable frameAnimation = (AnimationDrawable) splashImageView.getBackground();

  splashImageView.post(new Runnable() {
    @Override
    public void run() {
      frameAnimation.start();
    }
  });
  Thread splashTread = new Thread() {
    @Override
    public void run() {
      try {
        int waited = 0;
        while (_active && (waited < _splashTime)) {
          sleep(100);
          if (_active) {
            waited += 100;
          }
        }
      } catch (InterruptedException e) {
        // do nothing
      } finally {
        finish();
        mediaPlayer.release();
        startActivity(new Intent("com.goodguygames.bubblegame.demo.MainMenu"));
      }
    }
  };
  splashTread.start();
}
 
开发者ID:UshalNaidoo,项目名称:Android-Bubble-Game,代码行数:44,代码来源:SplashScreen.java


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