0
我学习XML现在定位在一排中间水平2元,我需要一点点帮助如何在相对布局
我需要做的是把一个TextView,随后在该中心的ImageView的水平。
下面的代码:
<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"/>
我使用相对布局为这个项目,我需要知道如何把这些元素的水平居中。
你可以换他们两个在的LinearLayout并给予了'centerHorizontal =“真”'价值,或者只是添加此'centerHorizontal =“真”'既他们会横向居中 –