1

5,4,3,2,1のように降順で表示および非表示にしたい5つの画像ボタンがあり、それが行われました。しかし、ImageButton1 に来ると、再び非表示にすることはできません。そのボタンで 2 つの条件が同時に実行されているためです。1 つは 2,3,4,5 ボタンを非表示にし、もう 1 つはその Imagebutton1 を非表示にしています。

     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;


        }
    });
4

0 に答える 0