Question

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!

Was it helpful?

Solution

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);
            }
        });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top