Scrollview only in the desired textView

Asked

Viewed 654 times

0

Good night to you all.

I’m with a simple layout containing a textView to control the title and other 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 obeying the layout integer, causing one text to overlap the other while using the Scroll. I’m using the RelativeLayout, because with the Linear did not succeed in 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>

1 answer

2


You have to put the positioning attributes in Scrollview and not in 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>

Browser other questions tagged

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