package kym.bluebyte.com.example.administrator.my1212;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Animation translate_1 = AnimationUtils.loadAnimation(this, R.anim.translate_1);
final Animation alpha_1 = AnimationUtils.loadAnimation(this, R.anim.alpha_1);
final TextView Text1 = (TextView)findViewById(R.id.text1);
Button Btn1 = (Button)findViewById(R.id.btn1);
Button Btn2 = (Button)findViewById(R.id.btn2);
Btn1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Text1.startAnimation(alpha_1);
}
});
Btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Text1.startAnimation(translate_1);
}
});
}
}
<?xml version="1.0" encoding="UTF-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="600"
android:repeatMode="restart"
android:repeatCount="-1"/>
<?xml version="1.0" encoding="UTF-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%p"
android:toXDelta="-100%p"
android:duration="6000"
android:repeatMode="restart"
android:repeatCount="-1"/>
안녕하세요 입문 개발자인데요
지금 만들려고하는게 텍스트뷰에 텍스트를 움직이거나 깜빡이거나 아니면 동시에 다 하고 싶은데
깜빡거리다가 이동버튼을 누르면 깜빡이는 애니메이션이 종료되고 이동만 하네요 그 반대도 그렇고..
물론 버튼 한개를 더 만들어서 translate랑 alpha를 set으로 묶어서 같이 동작하는 버튼을 만들면 가능하지만
저는 위 버튼 두개(반짝이게 하는 버튼, 이동하는 버튼)로만 만들고 싶은데 가능할까요?