Thanks Mark,
Can you point me to an example of this? I have tried to use
ArrayAdapter as my base class.
[CODE]
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
// When convertView is not null, we can reuse it directly,
there is no need
// to reinflate it. We only inflate a new View when the
convertView supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(R.layout.my_spinner_view,
null);
}
return convertView;
}
[/CODE]
The view I have created is this:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="14pt"
android:id="@+id/list" />
I keep getting a nullpointer exception at this line:
convertView = mInflater.inflate(R.layout.my_spinner_view,
null);
I don't know what to put in the
android:id="@+id/list" />
line, because the spinners are created at runtime and I do not know
the ID's at compile time.
I would like to add two different layouts to the spinner items, and
this could be done based on the position value I guess.
Thanks,
JP
On Jun 5, 7:30 pm, Mark Murphy <[email protected]> wrote:
> JP wrote:
> > Hi guys,
>
> > I am trying to change the text color of the spinner list items
> > individually.
>
> > I would like to be able to color the top three texts black and then
> > the bottom four grey. This way the last items look disabled, but I
> > still want to be able to capture the event when they are chosen.
>
> > I haven't been able to find any documentation on how to do that.
>
> Override getView() in your Adapter (or newView()/bindView() if you
> inherit from CursorAdapter) and render the rows yourself, however you wish.
>
> --
> Mark Murphy (a Commons
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Development Wiki:http://wiki.andmob.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---