我正在尝试使用该Animator集顺序播放一组动画.除了alpha动画(set1)之外,一切正常.它从0.25f变为1但在整个动画中并没有消失,在动画结束时set1它从0.25变为1而没有考虑到setDuration(因此我没有得到淡入效果).所以我没有淡出效果......当我自己做这个动画时,淡入效果就在那里......任何想法?
我正在使用精彩的nineoldandroids库来实现这一点.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ImageView image = (ImageView) findViewById(R.id.image);
final AnimatorSet set = new AnimatorSet();
set.play(ObjectAnimator.ofFloat(image, "translationX", 0, 100).setDuration(3000));
final AnimatorSet set1 = new AnimatorSet();
//THIS IS THE PROBLEMATIC ANIMATION!!
set1.play(ObjectAnimator.ofFloat(image, "alpha", 0.25f, 1).setDuration(3000));
final AnimatorSet set2 = new AnimatorSet();
set2.play(ObjectAnimator.ofFloat(image, "translationX", 100, 200).setDuration(3000));
final AnimatorSet set3 = new AnimatorSet();
set3.playSequentially(set,set1,set2);
set3.start();
}
Run Code Online (Sandbox Code Playgroud) 我在收音机组中有两个单选按钮.我还有2个androd:按钮复选框 - 用于取消选择单选按钮时的复选框,以及用户选择复选框时的checkbox_v.我也implemnted一个方法onRadioButtonClick,以确保只有一个单选按钮有绘制:复选框和其他已checkbox_v.我怎样才能实现onRadioClick来做到这一点?任何的想法?
public void onRadioButtonClick(View v)
{
RadioButton button = (RadioButton) v;
boolean checkBox1Selected;
boolean checkBox2Selected = false;
Toast.makeText(MainActivity.this,
button.getId()+ " was chosen."+R.id.wificheckBox,
Toast.LENGTH_SHORT).show();
if ( button.getId() ==R.id.wificheckBox) {
// Toggle status of checkbox selection
checkBox1Selected = radiowifiButton.isChecked();
// Ensure that other checkboxes are not selected
if (checkBox2Selected) {
radiomobileButton.setChecked(false);
checkBox2Selected = false;
}
else if (button.getId() ==R.id.wifimobilecheckBox) {
// Toggle status of checkbox selection
checkBox2Selected = radiomobileButton.isChecked();
// Ensure that other checkboxes are not selected
if …Run Code Online (Sandbox Code Playgroud) 我想为一个AnimationSet添加多个翻译动画.我目前这样做是通过设置一个侦听器到AnimationSet并在onAnimationEnd()方法上执行一个新的AnimationSet(见下文).这是很多代码,并想知道是否可以在一个AnimationSet中完成
任何的想法?
view_2_anim_c.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
apa2.startAnimation(view_2_anim_d);
//viewBAnimationD(apa2, 0);
}
});
Run Code Online (Sandbox Code Playgroud) 我可以从手机中检索图片并将它们存储在一个阵列中.之后我在屏幕上显示它们.但它们都有不同的形状和大小.我想以相同的尺寸和形状显示它们.任何的想法?
photoPaths = new ArrayList<String>();
getAllPhotos(Environment.getExternalStorageDirectory(), photoPaths);
images = new Bitmap[photoPaths.size()];
apa = (AnimationPhotoView)findViewById(R.id.animation_view);
for(int i=0;i<photoPaths.size();i++)
{
File imgFile = new File(photoPaths.get(0));
if(imgFile.exists())
{
images[0] = decodeFile(imgFile);}
Run Code Online (Sandbox Code Playgroud)