Skip to content Skip to sidebar Skip to footer

Android Listview Item Display Text Over Image Using Array Adapter

I have overloaded the getView method of listview to populate custom style of list item. This is what currently it looks like:!! Red color is to just show the background of listvi

Solution 1:

Ok, when calling getView() in your CustomArrayAdaptor, rather than set the ImageView bitmap to the image you have (what you are currently doing, I believe), instead call View.setBackgroundResource(R.drawable.yourimage.png) on your view after you have infalted it. The equivalent in xml is below:

android:background="@drawable/yourimage".

If you need more information, let me know.

Solution 2:

If you're using solid colors as the backgrounds, and you intend to support a variety of screen sizes, I would think it might be easier to use a background color fill on the text views, with the text views stacked and aligned such that there's no borders. Then it would not have any stacking issues (a simple Linear Layout would work) and it would be scalable with no processing of images.

Post a Comment for "Android Listview Item Display Text Over Image Using Array Adapter"