It's a very simple question but I dont get how to do it. I have a listview adapter and a xml row to display each row. I want to display 3 textview in a single row. This is my XML code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtElement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:textColor="#000000">
</TextView>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtElement2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:textColor="#000000">
</TextView>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/txtElement3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24px"
android:textColor="#000000">
</TextView>
</LinearLayout>
I want the text to be displayed like this:
txt1 txt2 txt3
And this is my adapter code (but I guess the problem is in the XML):
TextView tv = (TextView) row.findViewById(R.id.txtElement);
tv.setText(currentElement.getTitle());
TextView tv2 = (TextView) row.findViewById(R.id.txtElement2);
tv2.setText(currentElement.getAuthor());
TextView tv3 = (TextView) row.findViewById(R.id.txtElement3);
tv3.setText(""+currentElement.getNumPost());
Thanks in advance.