Reputation:
I'm studying XML right now and I need a little help
What I need to do is to put a TextView followed by an ImageView in the Center Horizontal.
Here's the code:
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/party_p"
android:layout_toEndOf="@id/TextView_congrats"
android:layout_marginTop="30dp" />
<TextView
android:id="@+id/TextView_congrats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Congrats Laura!"
android:textSize="30sp"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/white"
android:layout_marginTop="30dp"
android:paddingRight="20dp"/>
I'm using Relative Layout for this project and I need to know how to put those elements in the Horizontal center.
Upvotes: 0
Views: 39
Reputation: 881
Try this attribute in both views :
android:layout_centerHorizontal="true"
Upvotes: 1