Fix position of Relativelayout in Activity

Asked

Viewed 497 times

0

Good afternoon.

I want to fix the position of two RelativeLayout on the screen, but when the user changes the text of the TextSwitcher the RelativeLayout the one it belongs to increases in size, and so the Jump button is moving up and down and would like to leave it in the same place. How can I fix this problem?

Follows the XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="br.com.emergencyonline.Introduction" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/introduction_emergency_online"
    android:paddingTop="30dp"
    android:layout_gravity="center" />

<RelativeLayout 
    android:id="@+id/rlDescriptions"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    android:padding="50dp"
    android:background="@color/button_material_light">

<TextSwitcher 
    android:id="@+id/tsIntroduction"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" />

</RelativeLayout>

<RelativeLayout 
    android:id="@+id/rlPular"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@color/background_material_dark">

<Button 
    android:id="@+id/btnPular"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/jump" 
    android:gravity="center"
    android:layout_centerInParent="true"/>

</RelativeLayout> 

</LinearLayout>
  • 1

    The problem in this case is that you left the TextSwitcher have its variable size, and with changes you make, it floats whoever is below it. A possible solution would be to limit its size to as large as possible. Or change the position of the button.

  • That’s right @Wakim, thank you.

No answers

Browser other questions tagged

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