I'm trying to make a list, much like in reddit, where there is a upvote button on the left and some text to the right of that (a title, user who asked, number answers).
I'm trying to make a list containing viewgroups like so:
I haven't been able to add that Upvote button on the left side of the image. Whenever I add a button there, I can no longer click on the list item itself (previously if you clicked on the list item it would take you to another intent)
How can I create a list, where each item of the list is clickable to go to an intent based off that row item, but also have an upvote button for each row item of the list?
Here is what I am currently at:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="2dip"
android:paddingBottom="2dip"
>
<Button
android:layout_width="16dip"
android:layout_height="8dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:layout_marginTop="4dip"
android:background="@drawable/vote_up_gray"
android:id="@+id/vote_up_button"/>
<TextView
android:layout_width="40dip"
android:layout_height="32dip"
android:layout_alignParentLeft="true"
android:layout_below="@id/vote_up_button"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center"
android:textSize="14sp"
android:textStyle="bold"
android:text="0"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/Q_list_descriptions">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/title_text_view"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="@+id/askedBy_text_view" />
<TextView
android:layout_width="fill_parent"
android:gravity="right"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text=""
android:id="@+id/answers_text_view" />
</LinearLayout>
</LinearLayout>
</LinearLayout>