Question

Im using an inflater inside an adapter for my listview. I need to add in a different button depending in the state of the data for each row, so Im thinking I need to do this programmatically, but how do I make sure its inserted into the correct place inside the layout?

Was it helpful?

Solution

Have two view files for each scenario. You will overkill yourself with the problem to add views at the desired place by code.

Or have one view that holds the button, and set visibility to GONE to dismiss when you don't needed.

((TextView) inflatedview.findViewById(R.id.custombut)).setVisibility(View.GONE);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top