Defining your layout is simple. Just create a layout for a single
item. For instance, if you just wanted text, it would be a single
TextView. Then, when you go to set up your adapter, specify that as
the item layout to use.

As for multi-dimensional arrays, I haven't seen an example of this so
I don't know. You could probably just have two arrays defined in your
xml. I think they will maintain the same order.

On Apr 8, 1:08 pm, ThursdayMorning <[EMAIL PROTECTED]> wrote:
> Ah, I think I see your point. I don't need a different view layout for
> each item in the list, but I would like to define what's going to be
> in the layout of each item. The problem is I need *two* pieces of
> information for each layout, not one - the item resource for the icon,
> and the string resource for the text. Any way to define multi-
> dimensional arrays?
>
> On Apr 8, 3:52 pm, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > Well, I think you are mixing up what entries means. That refers to the
> > data that you want to show, whereas you are trying to set the UI for
> > displaying that data. If you need different layouts for each list item
> > in the listview, it might be possible, but probably requires some
> > coding.
>
> > On Apr 8, 12:20 pm, ThursdayMorning <[EMAIL PROTECTED]> wrote:
>
> > > I have a static context menu which I want to populate with a list.
> > > Each item has a graphic and some text associated with it. I could
> > > insert them programatically, but that would be a huge pain, so I want
> > > to do it in xml. ListView has the android:entries property which says
> > > you can load an array resource into the array, but it doesn't seem to
> > > be working with anything more complex than text. This is what I have:
>
> > > in: arrays.xml
> > > <resources>
> > >     <array name="menu_items">
> > >         <item>
> > >            <LinearLayout ... >
>
> > >                         <ImageView  ... />
>
> > >                         <TextView ...  />
>
> > >             </LinearLayout>
> > >         </item>
> > >         ...
> > >     </array>
> > > </resources>
>
> > > I *think* I should be able to load it like this:
>
> > > <ListView xmlns:android="http://schemas.android.com/apk/res/android";
> > >     ...
> > >     android:entries="@array/menu_items"
> > >     />
>
> > > But it just shows up blank. I'm not sure if this is a problem with my
> > > code, or if what I'm trying to do just isn't possible in Android.
>
> > > Thanks in advance,
> > >  - TM
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to