Display 2 or more textviews in one row

chriskwon7007 :

I saw some same questions, but I'm using android:orientation="vertical" so I can't use orientation as horizontal. How can I display 2 or more textviews on 1 row? (Sorry for my english skills)

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity"
        android:orientation="vertical"
        android:background="@drawable/background"
        android:weightSum="1">
<TextView
        android:layout_width="62dp"
        android:layout_height="28dp"
        android:layout_gravity="right"
        android:text="Sign in"
        android:textColor="#7041EE"
        android:textSize="20dp" />

    <TextView
        android:id="@+id/nwah"
        android:layout_width="162dp"
        android:layout_height="28dp"
        android:layout_gravity="left"
        android:text="New around here?"
        android:textColor="#ACACAC"
        android:textSize="20dp" />


</LinearLayout>

enter image description here

bhuvnesh pattnaik :
<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity"
        android:orientation="vertical"
        android:background="@drawable/background"
        android:weightSum="1">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="2">
    <TextView
        android:layout_width="0dp"
        android:layout_height="28dp"
        android:layout_gravity="right"
        android:layout_weight="1"
        android:text="Sign in"
        android:textColor="#7041EE"
        android:textSize="20dp" />

    <TextView
        android:id="@+id/nwah"
        android:layout_width="0dp"
        android:layout_height="28dp"
        android:layout_weight="1"
        android:layout_gravity="left"
        android:text="New around here?"
        android:textColor="#ACACAC"
        android:textSize="20dp" />
    </LinearLayout>
</LinearLayout>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=12507&siteId=1