private void showNext() { if (mPosition < mNewsData.size() - 1) { // 设置下一屏动画 mNewsBodyFlipper.setInAnimation(this, R.anim.push_left_in); mNewsBodyFlipper.setOutAnimation(this, R.anim.push_left_out); mPosition++; if (mPosition >= mNewsBodyFlipper.getChildCount()) { inflateView(mNewsBodyFlipper.getChildCount()); } // 显示下一屏 mNewsBodyFlipper.showNext(); } else { Toast.makeText(this, R.string.no_next_news, Toast.LENGTH_SHORT).show(); } }
public void next(View view) { if (index < mViewFlipper.getChildCount()) { mViewFlipper.setInAnimation(customAnimation.inFromRightAnimation()); mViewFlipper.setOutAnimation(customAnimation.outToLeftAnimation()); mViewFlipper.showNext(); index++; ToggleRadioButton(); } }
private void showNextView() { vf_pic.setInAnimation(AnimationUtils.loadAnimation(ctx, R.anim.push_left_in)); vf_pic.setOutAnimation(AnimationUtils.loadAnimation(ctx, R.anim.push_left_out)); vf_pic.showNext(); currentPage++; if (currentPage == vf_pic.getChildCount()) { dian_unselect(currentPage - 1); currentPage = 0; dian_select(currentPage); } else { dian_select(currentPage); dian_unselect(currentPage - 1); } }
private void showPreviousView() { dian_select(currentPage); vf_pic.setInAnimation(AnimationUtils.loadAnimation(ctx, R.anim.push_right_in)); vf_pic.setOutAnimation(AnimationUtils.loadAnimation(ctx, R.anim.push_right_out)); vf_pic.showPrevious(); currentPage--; if (currentPage == -1) { dian_unselect(currentPage + 1); currentPage = vf_pic.getChildCount() - 1; dian_select(currentPage); } else { dian_select(currentPage); dian_unselect(currentPage + 1); } }
private void showPrevious() { if (mPosition > 0) { mPosition--; // 记录当前新闻编号 HashMap<String, Object> hashMap = mNewsData.get(mPosition); mNid = (Integer) hashMap.get("nid"); if (mCursor > mPosition) { mCursor = mPosition; inflateView(0); System.out.println(mNewsBodyFlipper.getChildCount()); mNewsBodyFlipper.showNext(); // 显示下一页 } mNewsBodyFlipper.setInAnimation(this, R.anim.push_right_in); // 定义下一页进来时的动画 mNewsBodyFlipper.setOutAnimation(this, R.anim.push_right_out); // 定义当前页出去的动画 mNewsBodyFlipper.showPrevious(); // 显示上一页 } else { Toast.makeText(this, R.string.no_pre_news, Toast.LENGTH_SHORT).show(); } System.out.println(mCursor + ";" + mPosition); }