Place text underneath the image

1

I'm developing an application and I put an image with a text underneath but when I run the application it looks like the text on the side of the image:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
android:background="@android:color/holo_blue_light"
tools:context="com.example.tulio.myapplication.MainActivity">



<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView2"
    tools:layout_editor_absoluteY="280dp">


    <TextView
        android:id="@+id/textView2"
        android:layout_width="368dp"
        android:layout_height="wrap_content"
        android:text="@string/alan"
        tools:layout_editor_absoluteX="8dp"
        tools:layout_editor_absoluteY="297dp" />

</ScrollView>


<TextView
    android:id="@+id/txtNome1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:autoText="false"
    android:text="Alan Turing"
    android:textColor="?android:attr/colorActivatedHighlight"
    tools:layout_editor_absoluteX="161dp"
    tools:layout_editor_absoluteY="16dp" />


<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/alan"
    tools:layout_editor_absoluteX="106dp"
    tools:layout_editor_absoluteY="41dp" />

(Color.parseColor("#BABABA")); />

</android.support.constraint.ConstraintLayout>

How did the application

    
asked by anonymous 12.08.2017 / 19:36

2 answers

2

There are several ways to solve the problem. For example, enter a% w / o with vertical orientation. See:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
    android:background="@android:color/holo_blue_light">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/txtNome1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:autoText="false"
            android:text="Alan Turing"
            android:textColor="?android:attr/colorActivatedHighlight"
            tools:layout_editor_absoluteX="161dp"
            tools:layout_editor_absoluteY="16dp" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/cast_album_art_placeholder"
            tools:layout_editor_absoluteX="106dp"
            tools:layout_editor_absoluteY="41dp" />

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            tools:layout_editor_absoluteY="280dp">

            <TextView
                android:id="@+id/textView2"
                android:layout_width="368dp"
                android:layout_height="wrap_content"
                android:text="@string/alan"
                tools:layout_editor_absoluteX="8dp"
                tools:layout_editor_absoluteY="297dp" />
        </ScrollView>

    </LinearLayout>

</android.support.constraint.ConstraintLayout>
    
12.08.2017 / 19:59
2

Here's the resolution.

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <TextView
        android:id="@+id/txtNome1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Alan Turing"
        android:textColor="?android:attr/colorActivatedHighlight"
        android:textSize="30sp"
        android:textStyle="bold" />


    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="300dp"
        android:layout_height="300dp"
        app:srcCompat="@drawable/common_google_signin_btn_icon_dark" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/imageView2">


        <TextView
            android:id="@+id/textView2"
            android:layout_width="368dp"
            android:layout_height="wrap_content"
            android:text="@string/texto_autor" />

    </ScrollView>

</LinearLayout>

    
12.08.2017 / 19:50