[英]Horizontally center two TextView with RelativeLayout
我試圖將這兩個 TextView 水平居中,但似乎找不到解決方案。
<TextView
android:id="@+id/have_account_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/register_btn"
android:layout_marginTop="15dp"
android:text="Already have an account? "
android:textColor="@color/black" />
<TextView
android:id="@+id/login_now_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textFontWeight="700"
android:textColor="@color/main_blue"
android:layout_below="@+id/register_btn"
android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/have_account_tv"
android:text="Log in now" />
嘗試將以下屬性添加到 TextView XMLs
android:layout_centerHorizontal="true"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.