Jyothi Gowniwari
Jyothi Gowniwari

Reputation: 105

Left side text with seekbar does not align

in the below code want to display text named as intensity and left side of text want to display seekbar.
text was displaying properly but seekbar not showing any where

<RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/txt_intenisty_titiel"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginTop="30dp"
                        android:text="Intensity"
                        android:textColor="@android:color/white"
                        android:textSize="18sp" />

                    <SeekBar
                        android:id="@+id/intensity"
                        android:layout_width="wrap_content"
                        android:layout_height="60dp"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginLeft="70dp"
                        android:layout_marginTop="30dp"
                        android:layout_toRightOf="@+id/txt_intenisty_titiel"
                        android:background="@color/colorYellow"
                        android:thumb="@drawable/thumb_cicle_yellow"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true"
                        android:layout_alignBaseline="@+id/txt_intenisty_titiel"/>
                </RelativeLayout>

Upvotes: 1

Views: 375

Answers (1)

AskNilesh
AskNilesh

Reputation: 69709

Try this

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/txt_intenisty_titiel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Intensity"
        android:textColor="#FF00"
        android:textSize="18sp" />

    <SeekBar
        android:id="@+id/intensity"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentEnd="true"
        android:layout_centerInParent="true"
        android:layout_toRightOf="@+id/txt_intenisty_titiel"
        android:background="@color/colorRed"
        android:thumb="@drawable/ic_menu_send" />
</RelativeLayout>

OUTPUT

enter image description here

Upvotes: 1

Related Questions