am using a simple adapter to show set of strings in different text fields in a listview... i want when i click a particular content in that listview, some textview should be invisible.. how to do that...
my code is
String[] from = new String[] {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN"};
int[] to = new int[] { R.id.textView_1, R.id.textView_2, R.id.textView_3, R.id.textView_4, R.id.textView_5, R.id.textView_6, R.id.textView_7};
Adapter adapter = new SimpleAdapter(this, Maps, R.layout.search, from, to);
ListView lvSearch = (ListView) findViewById(R.id.listView_SearchResult);
lvSearchResult.setAdapter(adapter);
here on click
R.id.textView_5, R.id.textView_6, R.id.textView_7
should be invisible
Not sure what exactly you're looking for here, but if what you're trying to do is simply hide the TextView, you could do the following:
TextView txtView = (TextView)findViewById(R.id.textView_6);
txtView.setVisibility(View.GONE)
We can try and help you further if you provide us with a bit more information.
Set the attribute android:visibility="gone"
for the TextViews R.id.textView_5, R.id.textView_6, R.id.textView_7
in the layout layout.search
For your example I guess the result should look like:
<TextView android:id="@+id/textView_5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hidden" android:visibility="gone"/>
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