Android animation (ImageText disappear and everything else is filling free space)

StackOverflow https://stackoverflow.com/questions/23392258

  •  12-07-2023
  •  | 
  •  

سؤال

I have ImageView at the top and several EditTexts at the center. I want ImageView to dynamically disappear (when any of edits get focus) and move edits to the top to fill free space. How can I do this?

Thanks for all future responses!

هل كانت مفيدة؟

المحلول

Get your ImageView and EditText programatically.

e1=(EditText)findViewById(R.id.editText1);
e2=(EditText)findViewById(R.id.editText2);
i1=(ImageView)findViewById(R.id.imageView1);

Create an ontouchlistener for all your edit text's and then call setVisibility(View.GONE) on ImageView after checking for the focus of the edit texts.

e1.setOnTouchListener(new View.OnTouchListener()
        {
            public boolean onTouch(View arg0, MotionEvent arg1)
            {
                i1.setVisibility(View.GONE);
            }
        });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top