我有一個相對佈局,其中有一個照片庫和一個媒體播放器。我的問題是我想讓媒體播放器控制(暫停/播放/前進/後退)4個按鈕位於屏幕的底部,同時保持其中心水平對齊。我所做的是裏面嵌套線性佈局的相對佈局。如何將線性佈局放置在屏幕底部?
<?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:id="@+id/main_audio_view"
android:layout_height="match_parent"
android:background="@drawable/backgroundimg"
tools:context="com.my.project.LaunchGalleryview">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal"
android:layout_centerInParent="true"
android:gravity="bottom"
>
</LinearLayout>
</RelativeLayout>
線性佈局內的cutton全部居中,但整個線性佈局位於我的屏幕中心。我希望它在屏幕的底部。我已經嘗試過andoird:gravity =「bottom」它仍然位於屏幕的中心位置,我如何強制它位於底部?在線性佈局
爲什麼如果你想在底部使用'android:layout_centerInParent'?你爲什麼不使用'alignParentBottom'? –
很抱歉,英文不是我的第一語言,這就是爲什麼我難以理解文檔。我想保持水平中心對齊,這就是爲什麼我認爲layout_centerInParent將使用重力完成這項工作並將其拉下到屏幕的底部:「bottom」。這是我的問題的整個點(誤解文件) – TwoThumbSticks
我不明白爲什麼人們喜歡downvote新手初學者水平的問題這個人獲得什麼?請記住,你曾經是新手,犯了愚蠢的錯誤,也誤解了apis。也不是每個人都有第一語言的英語。上次我檢查這是一個社區互相幫助,我不知道新手不歡迎在這裏問。 – TwoThumbSticks