Position Textview Android Studio 2.2.2

Asked

Viewed 255 times

0

I’m hoping that one TextView is positioned on top of a text, but it is on the side

<?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"
android:orientation="horizontal"
android:background="@android:color/holo_green_light"
tools:context="com.example.tulio.myapplication.MainActivity">


<ImageView
    android:id="@+id/imageView"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    app:srcCompat="@drawable/knuth_b"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="59dp" />

<TextView
    android:id="@+id/txtNome2"
    android:layout_width="wrap_content"
    android:layout_height="39dp"
    android:autoText="false"
    android:padding="5dp"
    android:text="Donald Knuth"
    android:textColor="@android:color/holo_red_dark"
    tools:layout_editor_absoluteX="16dp"
    tools:layout_editor_absoluteY="31dp" />

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imageView"
    tools:layout_editor_absoluteY="280dp">
<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:text="@string/donald"
    android:textSize="12sp"
    tools:layout_editor_absoluteX="230dp"
    tools:layout_editor_absoluteY="59dp" />
 </ScrollView>

<![CDATA[

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

]]>
</LinearLayout>

I wanted Donald Knuth to be on top of the text Imagem

UPDATE man looks as it did, inserir a descrição da imagem aqui

1 answer

0


Nothing that a LinearLayout with vertical orientation cannot solve. See:

<?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"
    android:background="@android:color/holo_green_light"
    android:orientation="horizontal"
    tools:context="com.example.tulio.myapplication.MainActivity">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        app:srcCompat="@drawable/knuth_b"
        tools:layout_editor_absoluteX="8dp"
        tools:layout_editor_absoluteY="59dp" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="match_parent">

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

            <TextView
                android:id="@+id/txtNome2"
                android:layout_width="wrap_content"
                android:layout_height="39dp"
                android:autoText="false"
                android:padding="5dp"
                android:text="Donald Knuth"
                android:textColor="@android:color/holo_red_dark"
                tools:layout_editor_absoluteX="16dp"
                tools:layout_editor_absoluteY="31dp" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="10dp"
                android:text="@string/donald"
                android:textSize="12sp"
                tools:layout_editor_absoluteX="230dp"
                tools:layout_editor_absoluteY="59dp" />

        </LinearLayout>    
    </ScrollView>    
</LinearLayout>
  • ascklay I gave an update on the question Donald Knuth was positioned under the image and not on the text

  • @Felipepatrocinio corrected.

  • 1

    that’s right thanks for the help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.