Thursday, September 22, 2011

[android-developers] Re: how to show numbers before each string in ListView

Assuming that you are using a SimpleCursorAdapter you should look into
using a SimpleCursorAdapter.ViewBinder and maybe a custom list item
layout - useful if you want to further dress up your list in the
future.

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List3.html

When you implement the ViewBinder method #setViewValue(View view,
Cursor cursor, int columnIndex) you can obtain the index of your song
(in the list returned from Sqlite) by calling Cursor#getPosition().

Works about the same-ish for other adapters also.

On 22 Sep, 17:08, KK <dioxide.softw...@gmail.com> wrote:
> Hi All,
> I'm just trying to list song items and displaying it to user for selection.
> I'm using the following ListView for this purposes:
>
> <ListView android:id="@id/android:list"
>               android:layout_width="fill_parent"
>               android:layout_height="fill_parent"
>               android:layout_weight="1"
>               android:drawSelectorOnTop="false"/>
>
> and this list down the songs like this:
> songa
> songb
> songc
>
> Is there any option maybe shomething like android:numericlist which will
> list the songs like this:
> 1.songa
> 2.songb
> 3.songc
>
> Or may be some other elegant yet simple way to achieve the same effect.
>
> Any help would be highly appreciated.
>
> Thanks,
> KK

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment