本文整理了Java中android.widget.ViewFlipper
类的一些代码示例,展示了ViewFlipper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewFlipper
类的具体详情如下:
包路径:android.widget.ViewFlipper
类名称:ViewFlipper
暂无
代码示例来源:origin: stackoverflow.com
if (viewFlipper.getDisplayedChild() == 0)
break;
viewFlipper.setInAnimation(this, R.anim.in_from_left);
viewFlipper.setOutAnimation(this, R.anim.out_to_right);
viewFlipper.showNext();
if (viewFlipper.getDisplayedChild() == 1)
break;
viewFlipper.setInAnimation(this, R.anim.in_from_right);
viewFlipper.setOutAnimation(this, R.anim.out_to_left);
viewFlipper.showPrevious();
代码示例来源:origin: stackoverflow.com
imageFrame.setOnClickListener(PhotoSlideShowActivity.this);
imageFrame.setOnTouchListener(gestureListener);
slideShowBtn = (RelativeLayout) findViewById(R.id.slideShowBtn);
slideShowBtn.setOnClickListener(new OnClickListener() {
public void run() {
handler.postDelayed(runnable, 3000);
imageFrame.showNext();
imageView.setImageBitmap(imbm);
imageView.setLayoutParams(params);
flipper.addView(imageView);
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
handler.removeCallbacks(runnable);
imageFrame.setInAnimation(inFromRightAnimation());
imageFrame.setOutAnimation(outToLeftAnimation());
imageFrame.showNext();
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
handler.removeCallbacks(runnable);
imageFrame.setInAnimation(inFromLeftAnimation());
imageFrame.setOutAnimation(outToRightAnimation());
imageFrame.showPrevious();
代码示例来源:origin: stackoverflow.com
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.myViewFlipper);
// you can switch between next and previous layout and display it
viewFlipper.showNext();
viewFlipper.showPrevious();
// or you can switch selecting the layout that you want to display
viewFlipper.setDisplayedChild(1);
viewFlipper.setDisplayedChild(viewFlipper.indexOfChild(findViewById(R.id.secondLayout)
代码示例来源:origin: aporter/coursera-android
private void switchLayoutStateTo(int switchTo) {
mCurrentLayoutState = switchTo;
mFlipper.setInAnimation(inFromRightAnimation());
mFlipper.setOutAnimation(outToLeftAnimation());
mCount++;
if (switchTo == 0) {
mTextView1.setText(String.valueOf(mCount));
} else {
mTextView2.setText(String.valueOf(mCount));
}
mFlipper.showPrevious();
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.main);
flipper=(ViewFlipper)findViewById(R.id.details);
for (String item : items) {
Button btn=new Button(this);
btn.setText(item);
flipper.addView(btn,
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
}
flipper.setFlipInterval(2000);
flipper.startFlipping();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testStartFlipping() {
flipper.startFlipping();
assertTrue("flipping", flipper.isFlipping());
}
代码示例来源:origin: stackoverflow.com
ViewFlipper vflipper;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vflipper = (ViewFlipper) findViewById(R.id.viewFlipper);
vflipper.setInAnimation(this, android.R.anim.slide_in_left);
vflipper.setOutAnimation(this, android.R.anim.slide_out_right);
Button btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(this);
}
public void onClick(View v)
{
vflipper.showNext();
}
代码示例来源:origin: tyzlmjj/AndroidUI
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView textView = (TextView) findViewById(R.id.text);
final ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper);
flipper.addView(getImageView(R.mipmap.abcde_a));
flipper.addView(getImageView(R.mipmap.abcde_b));
flipper.addView(getImageView(R.mipmap.abcde_d));
flipper.setInAnimation(this, R.anim.push_up_in);
flipper.setOutAnimation(this, R.anim.push_up_out);
flipper.setFlipInterval(3000);
flipper.getInAnimation().setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
textView.setText((flipper.getDisplayedChild()+1)+"/"+flipper.getChildCount());
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
textView.setText((flipper.getDisplayedChild()+1)+"/"+flipper.getChildCount());
flipper.startFlipping();
}
代码示例来源:origin: stackoverflow.com
viewFlipper = new ViewFlipper(this);
ImageView i = new ImageView(this);
i.setImageResource(R.drawable.sample_1);
ImageView i2 = new ImageView(this);
i2.setImageResource(R.drawable.sample_2);
viewFlipper.addView(i);
viewFlipper.addView(i2);
viewFlipper.setInAnimation(slideLeftIn);
viewFlipper.setOutAnimation(slideLeftOut);
viewFlipper.showNext();
setContentView(viewFlipper);
viewFlipper.setInAnimation(slideRightIn);
viewFlipper.setOutAnimation(slideRightOut);
viewFlipper.showPrevious();
setContentView(viewFlipper);
代码示例来源:origin: stackoverflow.com
mViewFlipper.setDisplayedChild(0);
initAnimations();
gestureDetector = new GestureDetector(new MyGestureDetector());
mViewFlipper.setOnTouchListener(new OnTouchListener() {
if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
mViewFlipper.setInAnimation(mInFromRight);
mViewFlipper.setOutAnimation(mOutToLeft);
mViewFlipper.showNext();
} else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
mViewFlipper.setInAnimation(mInFromLeft);
mViewFlipper.setOutAnimation(mOutToRight);
mViewFlipper.showPrevious();
代码示例来源:origin: stackoverflow.com
viewFlipper.setLayoutParams(new AbsListView.LayoutParams(params));
viewFlipper.setInAnimation(TRANSLATE_LEFT_TO_RIGHT_VIEW_IN);
viewFlipper.setOutAnimation(TRANSLATE_LEFT_TO_RIGHT_VIEW_OUT);
viewFlipper.setFlipInterval(1000);
for (int i = 0; i < 10; i++) {
Button button = new Button(getApplicationContext());
button.setText("Button " + i);
viewFlipper.addView(button);
if (position == 0) {
if(!viewFlipper.isFlipping()) {
viewFlipper.startFlipping();
if(viewFlipper.isFlipping()) {
viewFlipper.stopFlipping();
代码示例来源:origin: ymback/NGA-CLIENT-VER-OPEN-SOURCE
@Override
public void updateHeaderView() {
mHeaderView.removeAllViews();
UserManager um = UserManagerImpl.getInstance();
final List<User> userList = um.getUserList();
if (userList.isEmpty()) {
mHeaderView.addView(getUserView(null, 0));
} else {
for (int i = 0; i < userList.size(); i++) {
mHeaderView.addView(getUserView(userList, i));
}
mHeaderView.setDisplayedChild(um.getActiveUserIndex());
}
mHeaderView.setOnClickListener(v -> mPresenter.toggleUser(userList));
mHeaderView.setInAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.right_in));
mHeaderView.setOutAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.right_out));
}
代码示例来源:origin: li2/learning-android-open-source
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
switch (position) {
case 0:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_up_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_up_out));
break;
case 1:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.push_left_out));
break;
case 2:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
break;
default:
mFlipper.setInAnimation(AnimationUtils.loadAnimation(this,
R.anim.hyperspace_in));
mFlipper.setOutAnimation(AnimationUtils.loadAnimation(this,
R.anim.hyperspace_out));
break;
}
}
代码示例来源:origin: stackoverflow.com
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper);
flipper.setInAnimation(this, R.anim.in);
flipper.setOutAnimation(this, R.anim.out);
flipper.startFlipping();
代码示例来源:origin: nvllsvm/Audinaut
private void toggleFullscreenAlbumArt() {
if (playlistFlipper.getDisplayedChild() == 1) {
playlistFlipper.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.push_down_in));
playlistFlipper.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.push_down_out));
playlistFlipper.setDisplayedChild(0);
} else {
scrollToCurrent();
playlistFlipper.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.push_up_in));
playlistFlipper.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.push_up_out));
playlistFlipper.setDisplayedChild(1);
UpdateView.triggerUpdate();
}
}
代码示例来源:origin: davideas/FlipView
/**
* Shows a specific View immediately, no animation will be performed.
* <p>Command is always performed even if the view is disabled.</p>
*
* @param whichChild the index of the child view to display (first View has {@code index=0}).
*/
public final void flipSilently(int whichChild) {
if (DEBUG) Log.d(TAG, "flipSilently whichChild=" + whichChild);
whichChild = checkIndex(whichChild);
Animation inAnimation = super.getInAnimation();
Animation outAnimation = super.getOutAnimation();
super.setInAnimation(null);
super.setOutAnimation(null);
super.setDisplayedChild(whichChild);
super.setInAnimation(inAnimation);
super.setOutAnimation(outAnimation);
}
代码示例来源:origin: stackoverflow.com
ViewFlipper flip = (ViewFlipper)findViewById(R.id.flipper);
flip.showNext();
flip.showPrevious();
代码示例来源:origin: jjhesk/KickAssSlidingMenu
@Override
public void onClick(View v) {
PushLeftPushRightAnimation me = PushLeftPushRightAnimation.this;
Context context = me;
int curView = mFlipper.getCurrentView().getId();
if (R.id.view1 == curView) {
in = AnimationUtils.loadAnimation(context, R.anim.push_right_in);
out = AnimationUtils.loadAnimation(context, R.anim.push_right_out);
} else {
in = AnimationUtils.loadAnimation(context, R.anim.push_left_in);
out = AnimationUtils.loadAnimation(context, R.anim.push_left_out);
}
in.setAnimationListener(me);
out.setAnimationListener(me);
mFlipper.setInAnimation(in);
mFlipper.setOutAnimation(out);
mFlipper.showNext();
}
}
代码示例来源:origin: stackoverflow.com
Animation fade_in, fade_out, rowanimation;
ViewFlipper viewFlipper;
ScrollView myView;
TextView date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewFlipper = (ViewFlipper) this.findViewById(R.id.bckgrndViewFlipper1);
fade_in = AnimationUtils.loadAnimation(this,
android.R.anim.fade_in);
fade_out = AnimationUtils.loadAnimation(this,
android.R.anim.fade_out);
viewFlipper.setInAnimation(fade_in);
viewFlipper.setOutAnimation(fade_out);
viewFlipper.setAutoStart(true);
viewFlipper.setFlipInterval(5000);
viewFlipper.startFlipping();
}
代码示例来源:origin: stackoverflow.com
ViewFlipper vf = (ViewFlipper) findViewById( R.id.viewFlipper );
vf.showNext();
内容来源于网络,如有侵权,请联系作者删除!