Android studio: Avoid centering controls within a LinearLayout (Horizontal) when there is more than one

0

I have this scenario

As you can see the control TextView with text Description is centered vertically with respect to the control Multiline Text . This happens automatically when I add the second control.

My intention is to avoid it, so that Description will remain in the area marked in red ( Multiline Text would remain immobile).

Extend everything you want in your answer, I'm new to Android Studio and this is my first job with Layouts . If you think that another type of layout would be better, please let me know.

    
asked by JD0001 21.09.2017 в 20:53
source

1 answer

0

Here I leave the code for the view you are looking for.

<?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"
    android:weightSum="1">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.09">

    <TextView android:id="@+id/desc"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12sp"
        android:textColor="@color/white"
        android:text="Descripción"/>

    <LinearLayout android:id="@+id/multitext"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginStart="4dip"
        android:orientation="vertical">

        <TextView
            android:id="@+id/multi"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical|center_horizontal"
            android:includeFontPadding="false"
            android:text="Esto es una descripción de lo que sucede..."
            android:textSize="30sp" />

    </LinearLayout>
</LinearLayout>

Greetings.

    
answered by 21.09.2017 в 23:43