I'm wondering if there is a way to hide a field in Android.
I tried with setting the value in a TextEdit and then making the TextEdit invisible, but the result is that the value is invisible, but the control takes space.
In my case, I want to store an extra value in a row of a ListView.
Is there another solution besides using hidden fields?
Use View's public static final int GONE
field.
In your case textEdit.setVisibility(View.GONE)
, or in xml android:visibility="gone"
Setting the view to INVISIBLE
does not take layout into consideration, but GONE
does.
View has methods setTag()
and getTag()
that you can use to associate some extra data with row of ListView. For example I'm using CursorAdapter
class and in newView()
and bindView()
methods I call view.setTag()
. Then in OnItemClickListener
I call view.getTag()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With