Java Code Examples for android.widget.ImageSwitcher#setOutAnimation()

The following examples show how to use android.widget.ImageSwitcher#setOutAnimation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageSwitcher1.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.image_switcher_1);

    mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);
    mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in));
    mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out));

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(new ImageAdapter(this));
    g.setOnItemSelectedListener(this);
}
 
Example 2
Source File: MainActivity.java    From journaldev with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mTextSwitcher = (TextSwitcher) findViewById(R.id.textSwitcher);
    mTextSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            TextView textView = new TextView(MainActivity.this);
            textView.setTextSize(18);
            textView.setGravity(Gravity.CENTER);
            return textView;
        }
    });

    mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
    mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);

    mImageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher);
    mImageSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            ImageView imageView = new ImageView(MainActivity.this);
            return imageView;
        }
    });
    mImageSwitcher.setInAnimation(this, android.R.anim.slide_in_left);
    mImageSwitcher.setOutAnimation(this, android.R.anim.slide_out_right);

    onSwitch(null);
}