有两个Button,一个控制另一个Button移动,可是当Button移动以后,这个Button的事件监听无法触发,各位大神帮帮忙!
解决方案 »
- 急。有关Android图库问题。
- 高分求助,android如何通过AT去拿到基站信息
- 急啊ksoap2调用webservice出错soapenv:Server' faultstring
- 做过JBOX2D或者BOX2D的进来看看!
- android开发时遇到的错误
- ubuntu下设置android开发环境错误
- 请教:Android模拟器问题,拜托各位!!
- 如何实现ActionBar标题栏(非选项)处的点击事件
- 监控短信,在BroadcastReceiver中发送邮件。。。模拟器正常,安装到真机上就不行了。。。求救
- 在线等 急~~~~~~
- 请教 Android Runtime.getRuntime().exec() 执行命令 权限问题
- QCOM_msm7x2xa中,原始music为什么暂停播放后1分钟才释放audiofocus焦点
public Animation getAnimation(float fromX, final int toX, float fromY,
final int toY, int time) {
TranslateAnimation translateAnimation = new TranslateAnimation(fromX,
toX, fromY, toY);
translateAnimation.setDuration(time);
translateAnimation.setFillAfter(true);
return translateAnimation;
}
这是给Button设置动画的函数:
public void initAnimation() {
if (mFlag) {
mButtonRefresh.startAnimation(mMySQLiteLogic.getAnimation(0f, -mWidth / 2 + mButtonRefresh.getWidth() / 2, 0f, 0, 1000));
mButtonSearch.startAnimation(mMySQLiteLogic.getAnimation(0f, mWidth / 2
- mButtonSearch.getWidth() / 2, 0f, 0, 1000));
mButtonAdd.startAnimation(mMySQLiteLogic.getAnimation(0f, 0, 0f,
-(mWidth / 2 - mButtonAdd.getWidth() / 2), 1000));
mFlag = false;
} else {
mButtonRefresh.startAnimation(mMySQLiteLogic.getAnimation(-mWidth / 2
+ mButtonRefresh.getWidth() / 2, 0, 0f, 0, 1000));
mButtonSearch.startAnimation(mMySQLiteLogic.getAnimation(mWidth / 2
- mButtonSearch.getWidth() / 2, 0, 0f, 0, 1000));
mButtonAdd.startAnimation(mMySQLiteLogic.getAnimation(0f, 0, -(mWidth / 2 - mButtonAdd.getWidth() / 2),
0, 1000));
mFlag = true;
}
}
点击这个按钮播放动画:
findViewById(R.id.button1).setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
Log.d("Button1", "lllllllllllllllllllll");
initAnimation();
}
});
帮我看看怎么解决,谢了!
public void onClick(View v) {
switch (v.getId()) {
case 1000:
Log.d("mButtonAdd", "mButtonAdd");
mMySQLiteLogic.startActivity();
break;
case 2000:
mMySQLiteLogic.searchDialog(v);
break;
case 3000:
Log.d("mButtonRefresh", "mButtonRefresh");
mMySQLiteLogic.updataAdapter();
break; case else: Log.d("other", "id = " + v.getId()); break;
}
}
};
mButtonAdd.setOnClickListener(l); mButtonAdd.setId(1000);
mButtonSearch.setOnClickListener(l); mButtonSearch.setId(2000);
mButtonRefresh.setOnClickListener(l); mButtonRefresh.setId(3000);