문제

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