1
在我的應用程序中,我目前在警報對話框中有兩個文本視圖來顯示溫度和天氣描述。這個問題是,只要描述發生變化,對齊就會改變。如何在Android Studio中正確地對齊我的文本?
我試圖讓我的佈局作爲一個相對佈局和移動他們兩個取決於其中一個,但這並沒有幫助我。有什麼建議麼?
這是我當前的代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/climaText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignStart="@+id/desc"
android:layout_marginTop="18dp"
android:layout_marginStart="120dp"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/climaText"
android:layout_centerHorizontal="true"
android:layout_marginTop="13dp"
android:textColor="@android:color/white" />
</RelativeLayout>
對不起,這沒有奏效。 –