ScrollView only in the desired textView

0

Good evening everyone.

I'm having a simple layout that contains a textView to control the title and another textView to control the content. What happens is that I have tried several times to include a ScrollView only in the second textView , but it is adhering to the layout integer, causing one text to overlap the other when using Scroll . I am using RelativeLayout , because with Linear I was not successful in the correct formatting.

content_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout   xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_activity_video03"
tools:context="luizugliano.com.br.appfilmes.ActivityVideo03">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Título"
    android:id="@+id/textView"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" />

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

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="TextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXX"
    android:id="@+id/textView2"
    android:layout_below="@+id/textView"
    android:layout_marginTop="51dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

</ScrollView>

    
asked by anonymous 20.10.2015 / 03:06

1 answer

2

You have to place placement attributes in ScrollView instead of TextView:

.........
.........
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textView"
    android:layout_marginTop="51dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="TextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXXTextoXXX"
        android:id="@+id/textView2"/>

</ScrollView>
    
20.10.2015 / 11:12