我做了一個android應用程序,其中包含scrollview佈局和裏面的AbsoluteLayout,問題是我無法顯示佈局的底部它只顯示佈局的頂部。我試圖在AbsoluteLayout中使用layout_marginBottom,但它不起作用。android無法顯示佈局的底部
0
A
回答
2
使用RelativeLayout
,而不是AbsoluteLayout
。也不要滾動總佈局。只需滾動View
。
檢查一次:不是Absolute..It
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="40dp"
android:background="@drawable/bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="300dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TextView" />
</ScrollView>
<Button
android:id="@+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Button" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btn1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp"
android:text="@string/s3"
android:textSize="16sp"
android:text="TextView" />
</RelativeLayout>
0
使用的RelativeLayout,並設置左,右頁邊距像
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lp.leftMargin = x;
lp.topMargin = y;
0
真實的,絕對佈局已被棄用。此外,這裏有一個提示:
爲Android創建xml佈局時,檢查錯誤的最簡單方法是使用xml佈局文件的「圖形佈局」選項卡。 。使用適當的設備配置(匹配您的設備)和API版本,重現該錯誤並查看更改佈局參數是否有幫助。
+0
它在圖形佈局上看起來很完美,但在模擬器或手機中測試時,它並不顯示整個佈局。 – 2014-09-26 13:19:17
0
使用性質的android:fillViewPort =內滾動型真如下
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg"
android:orientation="vertical" >
相關問題
- 1. 在android中滾動顯示的佈局中顯示廣告(頂部或底部)
- 2. Android佈局問題 - ListView無法顯示
- 3. Android佈局無法正常顯示
- 4. android佈局 - 頂部和底部
- 5. android scrollview不顯示佈局的頂部
- 6. Android佈局:底部有3個按鈕
- 7. 底部的佈局空間
- 8. Android中的底欄佈局
- 9. android gridview佈局縮小在CRT電視上顯示時的屏幕底部
- 10. 線性佈局的線性佈局無法正確顯示
- 11. 更改佈局後顯示底部表格
- 12. Android CrossFader顯示佈局
- 13. 無法將廣告置於線性佈局的底部
- 14. 無法正確對齊底部的佈局
- 15. 我無法獲得佈局底部的按鈕
- 16. 底部佈局棄用11.0
- 17. 底部工具欄佈局
- 18. Android按鈕佈局 - 無法正確顯示
- 19. Android Wear:佈局在仿真器中無法正確顯示
- 20. 如何設置頂部和底部的佈局Android
- 21. 如何在android中原始佈局的底部放置包含的佈局?
- 22. 佈局上的相對佈局的底部覆蓋
- 23. Android的調整佈局的一部分時,軟鍵盤顯示
- 24. android佈局中的段落顯示
- 25. Android的網格佈局不顯示
- 26. Android顯示重複/複製的佈局?
- 27. android顯示切割的佈局EditText
- 28. 包含的佈局未顯示在android
- 29. Android AdMob底部不顯示LinearLayout
- 30. Android底部元素沒有顯示
使用相對佈局或已LinearLayout中棄用.. – Ranjit 2014-09-26 13:01:07
你想要什麼顯示在佈局的底部.. – Ranjit 2014-09-26 13:02:23
@Ranjit帕蒂我加在圖片這個問題。 – 2014-09-26 13:19:55