从活动A开始了一个活动B,没有完成A。如果活动B完成了,我在活动A的onResume()中编写了一个方法,使ImageView不可见。但这是行不通的。代码如下所示。
public void onResume()
{
if(preferenceUtil.getMUSIC_ONOFF()==0) {
try {
player.start();
} catch (Exception e) {
e.printStackTrace();
}
}
giftbutton.setEnabled(true);
giftbutton.setClickable(true);
checkUnlockedStory();
super.onResume();
}
public void checkUnlockedStory()
{
if(preferenceUtil.getOVERALL_STARS()>=24)
{
giftbutton.setImageResource(R.drawable.gift);
giftbutton_count.setVisibility(View.INVISIBLE);
}
}发布于 2017-03-21 19:18:41
确保您有覆盖onResume方法:
@Override
protected void OnResume()
{
super.onResume();
//Type your code here
}发布于 2017-03-21 20:30:10
尝尝这个
giftbutton_count.setVisibility(View.GONE);发布于 2017-03-22 02:32:11
我认为你使用了错误的id,可能遗漏了这个。
giftbutton.setVisibility(View.INVISIBLE);
https://stackoverflow.com/questions/42925172
复制相似问题