java - 我想在单击单选按钮时为该布局设置动画。但它不起作用
问题描述
我想在单击单选按钮时为该布局设置动画。但它不起作用
这是我的布局 1
单选按钮的状态更改侦听器
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.radio_button_login){
Animation animation = AnimationUtils.loadAnimation(LoginActivity.this,R.anim.bottom_up);
signUpLayout.setAnimation(animation);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
signUpLayout.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}else {
Log.e("TAG", "onCheckedChanged: "+checkedId +" : "+ R.id.radio_button_login );
signUpLayout.setVisibility(View.VISIBLE);
}
}
});
但是动画只有在我点击布局中的 Edittext 时才开始
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:duration="200">
<scale android:fromXScale="100%" android:toXScale="100%" android:fromYScale="100%" android:toYScale="0%"/>
</set>
这是我的动画资源
解决方案
推荐阅读
- javascript - Firebase:doc.data() 返回空对象
- ios - 在swift中使用Timer更改标签时防止UIButton标签不闪烁
- sql - 选择上方或下方附加行的结果
- java - 在我的 java 函数中实现搜索
- php - php查询函数重复数据
- build - Netlify - 我的构建可执行文件的权限被拒绝
- spring-boot - PDF Excel 导出客户端和服务器端
- azure - 日志在 Azure 自定义日志中不可见
- ruby-on-rails - Rails Factory_Bot 和 reflect_on_association?
- php - PHP PDO 不工作,仍然可以 sql 注入