這個佈局的問題是當我定位時,文本視圖與按鈕重疊。我已經嘗試了框架佈局,重心和許多其他選項,但無濟於事。下面的圖片顯示了這個問題。我肯定需要使用RelativeLayout
。文字視圖與相對佈局的方向重疊
正如你所看到的,在景觀的情況下,測試的TextView被阻止。我想保持TextView
的垂直中心位置上的肖像模式和風景時模式下,TextView的定位BUTTON1之上,使得它不重疊。按鈕必須是保持在底部。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="TEST"
android:textAlignment="center"
android:textSize="36sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn1"
android:text="button1"/>
<Button
android:id="@+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btn3"
android:text="button 2"/>
<Button
android:id="@+id/btn3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="button 3"/>
</RelativeLayout>
您希望的行爲是什麼? –
你需要將按鈕對齊底部嗎? –
@Mahmet Kologlu - 我已經在問題的行爲上添加了描述。謝謝你指出, – user859385