I have a mapview with location overlay items. Now when the user clicks the overlay item pin/marker, I need to display a dialog with corresponding people at that location.
Now since some places have more than one person at the same location, I am trying to display them as a list. this part works fine.I want the ListView Layout to be wrap_content[both width and height]. Now my problem is that the height works fine and expands to the correct height to display the list items, but the width always expands to the width of the screen.
I have set all the widths in the list and the list items to be wrap_content but it still does the same. So I removed all the list items and tested it again and saw that it does it even when I have no list items.
Now if I remove the list though and only use a single textview then it works fine.
Here is my code that I use to inflate the layout.
LayoutInflater inflater =
(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout dialogLayout =
(LinearLayout)inflater.inflate(R.layout.location_list_dialog, null);
LayoutParams mapDialogParams = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
geoPoint, -1, -22,
LayoutParams.BOTTOM_CENTER);
mapView.addView(dialogLayout, mapDialogParams);
Can someone please let me know what I am doing wrong or how can I make the listview to have the appropriate width as its children.
Thank you.