本文整理汇总了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);
}
示例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);
}
}
}
}
示例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());
}
示例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);
}
});
}
示例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();
}
示例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();
}
}
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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));
}
}
}
示例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;
}
示例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();
}