I looked up several of the ideas, and ended up trying to add buttons to the listview. However, I'm running into this problem...
"ArrayAdapter requires the resource ID to be a TextView" The XML layout (task_item.xml) in question is: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:id="@+id/listAddTask" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Add Task" /> </RelativeLayout> and the code causing the problem is (after the button listener to save space): ...}); ArrayAdapter<String> tList = new ArrayAdapter<String>(this, R.layout.task_item, tasks); setListAdapter(tList); } I've been playing around with this for some time, and have combed google for an existing working example of buttons in a listview per row, but can't seem to find anything =( Thanks for any help, Moiraine On May 8, 5:37 pm, Mark Murphy <mmur...@commonsware.com> wrote: > moiraine wrote: > > I'm trying to use a ListView with Buttons beneath the listview, and am > > running into problems where the listview and buttons just don't > > realize each other are there (they overlap) > > > Currently the xml file is: > > <?xml version="1.0" encoding="utf-8"?> > > <RelativeLayout > > xmlns:android="http://schemas.android.com/apk/res/android" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content"> > > > <Button > > android:id="@+id/addTask" > > android:layout_width="fill_parent" > > android:layout_height="wrap_content" > > android:text="Add Task" /> > > > <ListView > > android:id="@id/android:list" > > android:layout_width="fill_parent" > > android:layout_height="fill_parent" > > android:drawSelectorOnTop="false"/> > > > </RelativeLayout> > > You have not specified any positioning rules, so these will overlap by > definition, given the way RelativeLayout works. Read up on > RelativeLayout.LayoutParams and add some more rules, such as > android:layout_below or android:layout_alignParentBottom. > > > I'm also not sure if using a ListView in this case is the correct > > solution. What I'm trying to do is have a list of options that the > > user can select, and when they select it, it remains highlighted, then > > I can use that value when I press another button, for example: > > > item 1 > > item 2 > > item 3 > > > [Move item up] > > [Move item down] > > > where [ ]'s are buttons > > That's not a good UI design for a touchscreen-centric platform. In > Android, there is no concept of "selection" when they use the > touchscreen, only when they use the D-pad/trackball. > > > Any suggestions with what I should actually be using? > > A context menu. > > Or, when they click on an item, bring up a "details activity" where they > can take actions via buttons or the option menu. > > Or, when they click on an item, bring up an AlertDialog where they can > take actions. > > Or, put move-up/move-down buttons in each row. > > Or, use drag-and-drop (there's some code in the open source project for > this in the Music app, used there for playlist management, though I > haven't tried separating it out into a reusable component) > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 3.0 > Available! > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow > athttp://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-beginners?hl=en -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en