I have created EditText
via xml file. I have to hide it when certain condition get true. I have tried
setVisibility(View.GONE)
and
setVisibility(View.INVISIBLE)
but nothing happens. Is there any specific way to do it or can it be done by another way? Please help me.
It seems it's impossible (well nothing is impossible :-)..check the update!). Check this question Is there a way to hide text in a TextView?. In an AbsoluteLayout you can only hide the text in a EditText or a TextView, but not the occupied space by these elements. That's why I'd recommend you to use RelativeLayout for this purpose instead of AbsoluteLayout.
Update
Using addView
and removeView
you can add and delete a View as follows
LinearLayout endTimeLayout = (LinearLayout) findViewById(R.id.endTimeLayout);
LinearLayout mainLayout = (LinearLayout) findViewById(R.id.mainLayout);
if (somecheckbox.isChecked())
mainLayout.removeView(endTimeLayout);
else
mainLayout.addView(endTimeLayout);
I'd continue recommend you to use RelativeLayouts if it's possible that are easy to manage.