我有5个图像按钮,我想通过降序显示和看不见。像5,4,3,2,1那样就完成了。但是当我来到ImageButton1时,我无法让它再次隐形。因为两个条件同时在该按钮上运行。一个是制作2,3,4,5按钮Invisible而另一个是制作Imagebutton1 Invisible.so我该怎么办?
imgmilku1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks1.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.INVISIBLE);
imgmilks3.setVisibility(View.INVISIBLE);
imgmilks4.setVisibility(View.INVISIBLE);
imgmilks5.setVisibility(View.INVISIBLE);
imgmilks3.setVisibility(View.INVISIBLE);
imgmilku1.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.VISIBLE);
imgmilku3.setVisibility(View.VISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilku5.setVisibility(View.VISIBLE);
firstglass = 1 * 300;
}
});
imgmilks1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
// imgmilks1.setVisibility(View.VISIBLE);
// imgmilku1.setVisibility(View.INVISIBLE);
imgmilks4.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilks5.setVisibility(View.INVISIBLE);
imgmilku5.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.VISIBLE);
firstglass = 1 * 300;
}
});
imgmilku2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks1.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilku1.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.VISIBLE);
secondglass = 2 * 300;
}
});
imgmilks2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks4.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilks5.setVisibility(View.INVISIBLE);
imgmilku5.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.VISIBLE);
secondglass = 2 * 300;
}
});
imgmilku3.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks1.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.VISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilku1.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.INVISIBLE);
thirdglass = 3 * 300;
}
});
imgmilks3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks4.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.VISIBLE);
imgmilks5.setVisibility(View.INVISIBLE);
imgmilku5.setVisibility(View.VISIBLE);
fourtglass = 0;
thirdglass = 3 * 300;
}
});
imgmilku4.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks1.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.VISIBLE);
imgmilks4.setVisibility(View.VISIBLE);
imgmilku1.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.INVISIBLE);
fourtglass = 4 * 300;
}
});
imgmilks4.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks5.setVisibility(View.INVISIBLE);
imgmilku5.setVisibility(View.VISIBLE);
fifthglass = 0;
fourtglass = 4 * 300;
}
});
imgmilku5.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
imgmilks5.setVisibility(View.VISIBLE);
imgmilks4.setVisibility(View.VISIBLE);
imgmilks3.setVisibility(View.VISIBLE);
imgmilks2.setVisibility(View.VISIBLE);
imgmilks1.setVisibility(View.VISIBLE);
imgmilku5.setVisibility(View.INVISIBLE);
imgmilku4.setVisibility(View.INVISIBLE);
imgmilku3.setVisibility(View.INVISIBLE);
imgmilku2.setVisibility(View.INVISIBLE);
imgmilku1.setVisibility(View.INVISIBLE);
firstglass = 0;
secondglass = 0;
thirdglass = 0;
fourtglass = 0;
fifthglass = 5 * 300;
}
});