private void initSwitchers() { temperatureSwitcher = (TextSwitcher) findViewById(R.id.ts_temperature); temperatureSwitcher.setFactory(new TextViewFactory(R.style.TemperatureTextView, true)); temperatureSwitcher.setCurrentText(temperatures[0]); placeSwitcher = (TextSwitcher) findViewById(R.id.ts_place); placeSwitcher.setFactory(new TextViewFactory(R.style.PlaceTextView, false)); placeSwitcher.setCurrentText(places[0]); clockSwitcher = (TextSwitcher) findViewById(R.id.ts_clock); clockSwitcher.setFactory(new TextViewFactory(R.style.ClockTextView, false)); clockSwitcher.setCurrentText(times[0]); descriptionsSwitcher = (TextSwitcher) findViewById(R.id.ts_description); descriptionsSwitcher.setInAnimation(this, android.R.anim.fade_in); descriptionsSwitcher.setOutAnimation(this, android.R.anim.fade_out); descriptionsSwitcher.setFactory(new TextViewFactory(R.style.DescriptionTextView, false)); descriptionsSwitcher.setCurrentText(getString(descriptions[0])); mapSwitcher = (ImageSwitcher) findViewById(R.id.ts_map); mapSwitcher.setInAnimation(this, R.anim.fade_in); mapSwitcher.setOutAnimation(this, R.anim.fade_out); mapSwitcher.setFactory(new ImageViewFactory()); mapSwitcher.setImageResource(maps[0]); mapLoadListener = new DecodeBitmapTask.Listener() { @Override public void onPostExecuted(Bitmap bitmap) { ((ImageView)mapSwitcher.getNextView()).setImageBitmap(bitmap); mapSwitcher.showNext(); } }; }
/** * Left to Right */ private void SliderLeftToRight() { // get current index pictureIndex = pictureIndex == 0 ? itemCount - 1 : pictureIndex - 1; // set Animation switcherImage.setInAnimation(AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left)); switcherImage.setOutAnimation(AnimationUtils.loadAnimation(context, android.R.anim.slide_out_right)); // switch indicator // switcherImage.setImageResource(image[pictureIndex]); switchIndicator(pictureIndex); }
/** * Right to Left */ private void SliderRightToLeft() { // get current index pictureIndex = pictureIndex == itemCount - 1 ? 0 : pictureIndex + 1; // set Animation // Custom the slide_out_left and slide_in_right switcherImage.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_in_right)); switcherImage.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_out_left)); // switcherImage.setInAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_in)); // switcherImage.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); // switch indicator // switcherImage.setImageResource(image[pictureIndex]); switchIndicator(pictureIndex); }
setContentView( ll ); final ImageSwitcher is = new ImageSwitcher( this ); is.setOutAnimation( this, R.anim.fadeout ); is.setInAnimation( this, R.anim.fadein ); ImageView iv1 = new ImageView( this );
imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));