我想要在頂部(包含按鈕)對齊一個水平滾動條,然後在此之後(其中可以包含我放入的任何東西)然後最後一個水平滾動條滾動條在底部對齊。如何強制將水平滾動條固定到頂部/底部,然後將中間展開的相對佈局與之間的其他所有元素進行比較?如何在Android中安排這三個項目
-1
A
回答
0
使用的LinearLayout ...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<RelativeLayout
android:id="@+id/top_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"></RelativeLayout>
<RelativeLayout
android:id="@+id/middle_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></RelativeLayout>
<RelativeLayout
android:id="@+id/bottom_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</LinearLayout>
使用的RelativeLayout ....
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@+id/top_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"></RelativeLayout>
<RelativeLayout
android:id="@+id/bottom_container"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/middle_container"
android:layout_width="match_parent"
android:layout_below="@id/top_container"
android:layout_above="@id/bottom_container"
android:layout_height="match_parent"></RelativeLayout>
</RelativeLayout>
0
可以使用layout_weight
一個LinearLayout
內有它填補了佈局擴張。
例如:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<!-- Buttons -->
</HorizontalScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<!-- Content -->
</RelativeLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<!-- More Buttons -->
</HorizontalScrollView>
</LinearLayout>
0
安置自己的線框,以便我們能夠更好的幫助。不過我認爲你的解決方案可能是: - 保持你的主佈局爲RelativeLayout。在你的主佈局下以垂直方向取向另一個LinearLayout。在LinearLayout和LinearLayout之外放置水平滾動視圖和其他項目,使用此屬性保持水平滾動視圖:
機器人:layout_alignParentBottom = 「真」
您的XML看起來就像這樣:
<RelativeLayout>
<LinearLyout>
// horizontal scrollview
// other items
</LinearLayout>
// horizaontal scrollview with alignparentbottom="true"
</RelativeLAyout>
相關問題
- 1. 如何安排C#項目?
- 2. 如何在Android中排序RecyclerView項目
- 3. gradle這個排除項目
- 4. 如何安排三個線性佈局?
- 5. 將2個android項目集成到第三個項目中
- 6. 如何將與Android gradle這個項目拉特許可項目
- 7. LinearLayout安排項目
- 8. 如何讓這個`R`在android項目中快樂?
- 9. 如何安排gridview的項目?
- 10. Listview項目在第三個項目點擊後不可見android
- 11. android - 如何安排兩個textview並排
- 12. 如何在SilverLight中安排表格佈局中的項目?
- 13. 如何在運行時在TabBarcontroller中安排tabbar項目?
- 14. 的Android安裝DBFlow庫在我的項目gradle這個
- 15. 如何安排在Android
- 16. 在DataTemplate中安排ItemsControl項目
- 17. Android:如何安排?
- 18. 如何在eclipse中安排我的項目的文件夾項目?
- 19. 在android studio中安排項目的正確方法是什麼?
- 20. 如何安排在項目中的刪除過程
- 21. 如何在Kohana 3項目中安排業務邏輯
- 22. 如何在android中安排短信?
- 23. 如何在Android中安排通知
- 24. 安排在Android中
- 25. Proguard:在Android中排除庫項目
- 26. 如何將這個android庫導入到我的項目中?
- 27. 如何在eclipse中的另一個android項目中添加android庫項目
- 28. 如何在android中逐個安排3個任務?
- 29. 如何在android中的項目列表上應用排序
- 30. 如何安排如圖所示的QGridLayout中的項目?
您可以發佈小號creenshot或線框或代碼 –
您可以使用此佈局的分區lik使用layout_weight =「」 –
我希望頂部和底部具有包裹其內容的高度,但是中心相對佈局覆蓋了所有介於 –