Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is android:layout_alignLeft in Android?

i couldnt understand the attribute android:layout_alignLeft .i am new to android development.

<RelativeLayout 
        android:id="@+id/r5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/r4"

        > <TextView
              android:id="@+id/tv3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true"
              android:layout_centerVertical="true"
              android:layout_marginTop="10dp"
               android:textSize="16sp"
              android:textColor="#663300"
              android:text="TextView"

               />

          <TextView
              android:id="@+id/tv5"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"            
              android:layout_marginTop="10dp"

              android:layout_alignLeft="@id/tv3"
               android:textSize="16sp"
              android:textColor="#663300"
              android:text="TextView"


               />
         <TextView
              android:id="@+id/tv6"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_toRightOf="@id/tv5"
              android:layout_marginTop="10dp"
               android:textSize="16sp"
              android:textColor="#663300"
              android:text="TextView"

               />

          </RelativeLayout>

anyone can explain clearly?what is the difference between android:layout_Leftof and android:layout_alignLeft?

like image 941
Rajesh Lawrance Avatar asked Feb 01 '13 04:02

Rajesh Lawrance


1 Answers

layout_alignLeft makes the left edge of your view match the left edge of the view whose ID you use as the parameters.

layout_toLeftOf makes your view placed to the left side of the view whose ID you use (the right edge will be aligned with the left edge of the other view).

like image 77
Kevin Coppock Avatar answered Oct 07 '22 00:10

Kevin Coppock