multiple textview in a row

后端 未结 2 2040
情书的邮戳
情书的邮戳 2021-01-20 03:13

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

相关标签:
2条回答
  • 2021-01-20 03:22

    What you need to do is to only change the orientation from vertical to horizontal.

    0 讨论(0)
  • 2021-01-20 03:31

    Change orientation android:orientation="horizontal" of LinearLayout.

    EDIT

    And how if I would like to display it like: txt1 in one line and txt2 txt3 in a second line?

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="5dp"
            android:text="1" />
    
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/textView1"
            android:layout_below="@+id/textView1"
            android:text="2" />
    
        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textView1"
            android:layout_marginLeft="5dp"
            android:layout_toRightOf="@+id/textView2"
            android:text="3" />
    
    </RelativeLayout>
    
    0 讨论(0)
提交回复
热议问题