Sunday, April 21, 2013

[android help] Android Listview Item not drawn after setVisibility(View.VISIBLE) is called


I have a list view each row in the list view has height of 450dp for an example so in most cases, the listview will render at MOST 3 items at the time.


when list view is initially loaded, each row is just an image with a button that says "show details" (all contained in a relative layout) when user clicks on the button, it hide the current relative layout that has an image and a button by calling setVisibility(View.GONE), and make another view (LinearLayout) shown by calling setVisibility(View.VISIBLE)


Remember BOTH relative layout and Linear Layout reside in the same xml that was inflated in Adapter.getView(), i am just toggle one of the other in terms of the visibility.


the issue is that, after calling setVisibility(View.VISIBLE) is called on the linear layout, it doesn't show. It did successfully hide the relative layout, but the linearly layout did not appear.


It only appears AFTER a new item in the list view needs to be rendered by scrolling the list view up and down.


how can i force the relative layout to get shown? by force redrawing? i tried that by calling invalidate, it did not work.


i also tried requestLayout, but again, no use.


i also tried notifyDataSetChanged(), it did not work, and i don't think i should call it anyway, because nothing in the data in the adapter has changed, i am simple hiding and showing a new view.


please help



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...