gpt4 book ai didi

android - 消失前在复选框中显示勾号

转载 作者:行者123 更新时间:2023-11-29 23:41:21 27 4
gpt4 key购买 nike

我有下面这段代码:当你勾选checkbox时,一个spinnerbuttoncheckbox消失。

但是当我运行该应用程序并勾选 checkbox 时,checkbox 就消失了,而没有在框中显示“勾选”?有没有一种方法可以让我看到带有勾号的框,然后元素会淡出

谢谢!

代码:

newCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// makes the set disappear when checkbox is ticked.
newCheckbox.setVisibility(View.GONE);
newButton.setVisibility(View.GONE);
spinner.setVisibility(View.GONE);
}
});

最佳答案

试试这个,

newCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// makes the set disappear when checkbox is ticked.

newCheckBox.setVisibility(View.VISIBLE);
newButton.setVisibility(View.VISIBLE);
spinner.setVisibility(View.VISIBLE);

newCheckBox.animate().alpha(0.0f).setDuration(1000).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
newCheckBox.setVisibility(View.GONE);
}
});

newButton.animate().alpha(0.0f).setDuration(1000).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
newButton.setVisibility(View.GONE);
}
});

spinner.animate().alpha(0.0f).setDuration(1000).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
spinner.setVisibility(View.GONE);
}
});

}
});

关于android - 消失前在复选框中显示勾号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51833788/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com