There is the following xml markup:

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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"> <RelativeLayout 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" tools:context=".MainActivity"> <ImageView android:layout_width="300dp" android:layout_height="300dp" android:layout_centerHorizontal="true" android:src="@drawable/note_icon" tools:ignore="ContentDescription" /> <Button android:id="@+id/prev" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:layout_marginEnd="30dp" android:layout_marginBottom="200dp" android:layout_toStartOf="@id/play" android:background="@drawable/round_buttons" android:layout_alignParentBottom="true" android:text="@string/prev" /> <Button android:id="@+id/play" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:background="@drawable/round_buttons" android:layout_marginBottom="200dp" android:layout_alignParentBottom="true" android:text="@string/play" /> <Button android:id="@+id/next" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:layout_marginStart="30dp" android:layout_toEndOf="@id/play" android:background="@drawable/round_buttons" android:layout_marginBottom="200dp" android:layout_alignParentBottom="true" android:text="@string/next" /> <SeekBar android:id="@+id/seekBar" android:layout_width="match_parent" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="60dp" /> <TextView android:id="@+id/curTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/seekBar" android:text="@string/_0_00" /> </RelativeLayout> </android.support.design.widget.CoordinatorLayout> 

The problem is the following - when the TextView is over the SeekBar everything is displayed as it should, but if you place the TextView under the SeekBar , then the TextView flies somewhere down and you can’t even see it. What is the problem?

UPD

Picked everywhere android:layout_alignParentBottom="true" and slightly changed the markup. Now it looks like this:

  <RelativeLayout 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" tools:context=".MainActivity"> <ImageView android:id="@+id/image" android:layout_width="300dp" android:layout_height="300dp" android:layout_centerHorizontal="true" android:src="@drawable/note_icon" tools:ignore="ContentDescription" /> <Button android:id="@+id/prev" android:layout_below="@id/image" android:layout_marginTop="10dp" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:layout_marginEnd="30dp" android:layout_toStartOf="@id/play" android:background="@drawable/round_buttons" android:text="@string/prev" /> <Button android:id="@+id/play" android:layout_below="@id/image" android:layout_marginTop="10dp" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:background="@drawable/round_buttons" android:text="@string/play" /> <Button android:id="@+id/next" android:layout_width="60dp" android:layout_height="60dp" android:layout_centerHorizontal="true" android:layout_marginStart="30dp" android:layout_toEndOf="@id/play" android:background="@drawable/round_buttons" android:layout_below="@id/image" android:layout_marginTop="10dp" android:text="@string/next" /> <SeekBar android:id="@+id/seekBar" android:layout_width="match_parent" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@id/play" android:layout_marginTop="150dp"/> <TextView android:id="@+id/curTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/seekBar" android:text="@string/_0_00" /> </RelativeLayout> </android.support.design.widget.CoordinatorLayout> 

However, now the reverse problem - under SeekBar text is located normally, and if you set it over it - flies to the level of the buttons.

  • Problem in alignParentBottom=true for Seekbar - Jarvis_J
  • @Jarvis_J, updated the question - Sergei Mikhailovskii
  • 2
    now it's due to marginTop in SeekBar 'e. Decide what you want - the text is on top (then SeekBar alignParentBottom ) or below (then the text alignParentBottom , and SeekBar is above ) - Jarvis_J
  • @Jarvis_J, I understand, just expected the same behavior as under, and above. Thank. Post as an answer? - Sergei Mikhailovskii
  • There are two questions for attention) I do not see the point - Jarvis_J

0