我正在创建一个设置活动,无论用户是否能够激活/取消激活通知。现在我想显示/隐藏点击切换按钮上的某些选项。我可以隐藏视图但不知道如何再次显示?在这里,我正在粘贴我的切换代码:如何显示/隐藏视图/布局在开关点击android?
notify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if(b)
{
notifyMail.animate()
.translationY(0)
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
notifyMail.setVisibility(View.GONE);
}
});
notifyPhone.animate()
.translationY(0)
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
notifyPhone.setVisibility(View.GONE);
}
});
notifyHitcher.animate()
.translationY(0)
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
notifyHitcher.setVisibility(View.GONE);
}
});
notifyDriver.animate()
.translationY(0)
.alpha(0.0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
notifyDriver.setVisibility(View.GONE);
}
});
}
else
{
notifyMail.animate().translationY(0);
}
}
});
其余部分将在其他部分完成{}。在此先感谢
非常感谢你,你的解决方案工作:) – ManishNegi