Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

New Forums: Nexus Player | Nexus 9
test: Reply
 
LinkBack Thread Tools
Old April 6th, 2011, 04:28 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Apr 2011
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default list with multiple items in one row

Hi,

I am trying to figure out how to create a List that contains multiple items on one row. What I want is to have a ListActivity and put multiple buttons on the same row (at least 2), depending on the space available on the device's screen. The user should be able to click/select any of the items in one row.

I need a list because I will get the data from the database through a Cursor (I will implement a CursorAdapter for that, accessing my local SQLite db)

All the examples that I've seen so far have only one item per row, so if anybody can give me such an example/explain what's needed, I would be grateful.

Thank you,
Ionut

Advertisements
sionut is offline  
Reply With Quote
sponsored links
Old April 7th, 2011, 07:43 PM   #2 (permalink)
Member
 
Join Date: Sep 2010
Posts: 123
 
Device(s): HTC EVO 4G
Carrier: Not Provided

Thanks: 4
Thanked 15 Times in 11 Posts
Default

I'm not sure if this is the best way, but this is how I would do it off the top of my head (I'm also not hugely familiar with all of android). You can create a separate layout for your components

buttons.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="horizontal">
 <Button android:id="@+id/one"/>
<Button android:id="@+id/two"/>
</LinearLayout>
Then in your main layout create a ListView called list. Then create your own custom adapter such as an ArrayAdapter that takes R.id.list as its resource and then on getView fill in the listeners with the buttons and/or text
RazzleFnDazzle is offline  
Reply With Quote
Reply
Tags
cursor, items, list, listactivity, listview, multiple


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:58 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.