我正在努力與TextViews
。我希望他們彼此相鄰,但在相反的屏幕邊。首先應該在屏幕的左側,第二個在右側。這是我的代碼:Android:在不同屏幕邊上彼此相鄰的TextViews
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/unit"
android:textSize="22sp"
android:text="Unit"/>
<TextView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/unitName"
android:text="Km"
android:textColor="@android:color/darker_gray"
android:textSize="22sp"/>
</LinearLayout>
我試圖layout_gravity
和gravity
,它不工作。我正在試驗wrap_content
和match_parent
,但我的TextViews
只是彼此相鄰。我希望他們在屏幕的兩側。我該怎麼辦?