android.widget.ViewFlipper.getChildCount()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中android.widget.ViewFlipper.getChildCount()方法的一些代码示例,展示了ViewFlipper.getChildCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewFlipper.getChildCount()方法的具体详情如下:
包路径:android.widget.ViewFlipper
类名称:ViewFlipper
方法名:getChildCount

ViewFlipper.getChildCount介绍

暂无

代码示例

代码示例来源:origin: tyzlmjj/AndroidUI

@Override
public void onAnimationEnd(Animation animation) {
  textView.setText((flipper.getDisplayedChild()+1)+"/"+flipper.getChildCount());
}

代码示例来源:origin: MinTate/Mleaf

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();
  }
}

代码示例来源:origin: MinTate/Mleaf

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);
}

代码示例来源:origin: stackoverflow.com

if (vf.getDisplayedChild()==vf.getChildCount()-1)
  break;

代码示例来源: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: clemensbartz/essential-launcher

/**
 * Switch to a layout.
 *
 * @param id the id of the layout
 */
public void switchTo(final int id) {
  final ActionBar actionBar = getActionBar();
  switch (id) {
    case HOME_ID:
      if (actionBar != null && actionBar.isShowing()) {
        actionBar.hide();
      }
      break;
    default:
      if (actionBar != null && !actionBar.isShowing()) {
        actionBar.show();
      }
      break;
  }
  // Show grid as fall-back if somebody hacked our config
  if (id < 0 || id > vsLauncher.getChildCount()) {
    switchTo(HomeModel.GRID_ID);
  } else {
    vsLauncher.setDisplayedChild(id);
  }
}

相关文章