示例#1
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.codelayout);

    LinearLayout MyLinear = (LinearLayout) findViewById(R.id.mylinear);
    MyLinear.setOrientation(LinearLayout.HORIZONTAL);

    Button MyBtn = (Button) findViewById(R.id.mybutton);
    MyBtn.setTextSize(40);

    EditText MyEdit = (EditText) findViewById(R.id.myedit);
    MyEdit.setBackgroundColor(0xff00ff00);
  }
示例#2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tweenlistener);

    mLinear = (LinearLayout) findViewById(R.id.linear);

    mBtn = (Button) findViewById(R.id.start);
    mBtn.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            // * 리스너로 연결하기
            mBtn.startAnimation(mAni1);
            // */
            /* 오프셋으로 연결하기
            mBtn.startAnimation(AnimationUtils.loadAnimation(
            		TweenListener.this, R.anim.offset));
            //*/
          }
        });

    mAni1 = AnimationUtils.loadAnimation(this, R.anim.rotate2);
    mAni2 = AnimationUtils.loadAnimation(this, R.anim.alpha2);
    mAni3 = AnimationUtils.loadAnimation(this, R.anim.scale2);

    mAni1.setAnimationListener(
        new AnimationListener() {
          public void onAnimationEnd(Animation animation) {
            mBtn.startAnimation(mAni2);
          }

          public void onAnimationRepeat(Animation animation) {
            ;
          }

          public void onAnimationStart(Animation animation) {
            ;
          }
        });

    mAni2.setAnimationListener(
        new AnimationListener() {
          public void onAnimationEnd(Animation animation) {
            mBtn.startAnimation(mAni3);
          }

          public void onAnimationRepeat(Animation animation) {
            ;
          }

          public void onAnimationStart(Animation animation) {
            ;
          }
        });

    mAni3.setAnimationListener(
        new AnimationListener() {
          public void onAnimationEnd(Animation animation) {
            Toast.makeText(TweenListener.this, "Animation End", 0).show();
          }

          public void onAnimationRepeat(Animation animation) {
            ;
          }

          public void onAnimationStart(Animation animation) {
            ;
          }
        });
  }