當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。