Yes, the example can be modified to do more or less what I wanted. Here is
what I changed:

inside getView in Main.java:
=======================================================================

            }else{
                row = inflater.inflate(R.layout.list_row_layout_odd, parent,
false);
              TextView textLabel = (TextView) row.findViewById(R.id.text);
                TextView textLabel2 = (TextView)
row.findViewById(R.id.text2);
                textLabel.setText(data[position]);
                textLabel2.setText(data[position]);
            }

            return (row);
        }
==========================================================

Then at the bottom of row_layout_odd.xml inside the relative layout:

  <TextView android:id="@+id/text2"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_alignParentLeft="true"
    android:textColor="#ffffff"
    android:textSize="16dip"
    android:layout_marginRight="120dip"
    android:layout_marginLeft="8dip"
    android:layout_marginTop="30dip" />

==========================================================

I am still curious though on how this solution differs from the one
suggested
by Romain Guy. Anyone have any thoughts on this?

Thanks,

John Goche

On Sun, Sep 18, 2011 at 8:26 PM, John Goche <[email protected]>wrote:

>
> I have found another custom adapter tutorial at the following site:
>
> http://thetechnib.blogspot.com/2010/12/android-tutorial-custom-adapter-for.html
> I am going to try and modify it and see whether I can get what you suggest
> to work here.
>
> John Goche
>
>
> On Sun, Sep 18, 2011 at 7:48 PM, John Goche <[email protected]>wrote:
>
>>
>> Thanks Romain,
>>
>> Thank you for your answer. I would like to use the second method. Can you
>> please
>> tell me a little bit more about how to use the two methods you describe.
>> First of all, which
>> Adapter class should I subclass (if I need to subclass at all). Can I
>> subclass SimpleAdapter?
>> I was able to understand the following code:
>> http://ykyuen.wordpress.com/2010/01/03/android-simple-listview-using-simpleadapter/but
>>  I am not sure whether I can adapt it to use getItemViewType and
>> getViewTypeCount.
>> My rows contain textviews with strings but it seems like I am looking in
>> the wrong place.
>>
>> Thanks again,
>>
>> Regards,
>>
>> John Goche
>>
>>
>> On Sat, Sep 17, 2011 at 8:52 PM, Romain Guy <[email protected]>wrote:
>>
>>> Hi John,
>>>
>>> You have to do it programmatically from the adapter. You have two ways of
>>> doing it. Either you can use a single list item with some of its child views
>>> marked with a GONE visibility or you can use different list items. The
>>> preferred solution is the latter. If you decide to use it, you need to
>>> override getItemViewType() and getViewTypeCount().
>>>
>>> Android's XML files do not contain logic.
>>>
>>> On Sat, Sep 17, 2011 at 11:47 AM, John Goche <[email protected]
>>> > wrote:
>>>
>>>>
>>>> Hello,
>>>>
>>>> I need a dynamic list view which has heterogenous row entries.
>>>> For instance one item may have two text edits whereas another
>>>> list item may have four text edits. Does this mean I have to do it
>>>> all programmatically and cannot encode an <if> (say like in Java
>>>> Apache Tomcat Struts Library) to decide how my list row should
>>>> appear (with 2 or with 4 text edits)?
>>>>
>>>> What other options would I have to do this?
>>>>
>>>> Thanks,
>>>>
>>>> John Goche
>>>>
>>>>  --
>>>> 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
>>>
>>>
>>>
>>>
>>> --
>>> Romain Guy
>>> Android framework engineer
>>> [email protected]
>>>
>>>  --
>>> 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
>>
>>
>>
>

-- 
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

Reply via email to