我有很多的項目,做工精細垂直滾動佈局。
我想將一個新的線性佈局放置在屏幕的底部,而不是可滾動佈局的一部分。
也就是說,它將坐在獨立於可滾動部分的按鈕上(如adview)。 我只能將它放在scrollView中。
如何將它放在下方,因此始終可見?我怎樣才能把新的項目下的滾動型
4
A
回答
1
如果您使用垂直LinearLayout
來保存可滾動佈局,那麼您可以將adview添加到可滾動佈局下面的LinearLayout
,它將出現在屏幕的底部。 (假設您的權重設置正確,並且滾動佈局設置爲WRAP_CONTENT
)
A RelativeLayout
將允許您將adview設置爲與滾動佈局的底部一致,但您仍然需要確保可滾動佈局設置爲WRAP_CONTENT
,因此它不會自動佔用整個屏幕。
5
這樣的事情:)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>
<LinearLayout android:id="@+id/bottom"
android:layout_width="fill_parent"
android:layout_height="10dip" />
</LinearLayout>
您將您的底部添加內容底部的LinearLayout與Android:ID =底部:)
19
使用的RelativeLayout,並組織這樣說:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_above="@+id/linearLayoutThatDoesNotScroll" >
<LinearLayout
android:id="@+id/linearLayoutWithLotofContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/linearLayoutThatDoesNotScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" >
</LinearLayout>
</RelativeLayout>
技巧是在ScrollView放置中,同時它與屏幕的頂部對齊,並在較低的固定的LinearLayout上方對齊。它只是工作。
+1
**多麼甜蜜!**像魅力一樣工作,謝謝! – user1073511
+0
我們不能使用LinearLayout而不是Relative? –
1
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/dialogButtonOK"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text=" Ok "
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:background="@drawable/button_style"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:id="@+id/scrView"
android:layout_above="@id/dialogButtonOK"
android:layout_alignParentTop="true"
>
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:id="@+id/main_table" >
</TableLayout>
</HorizontalScrollView>
</ScrollView>
</RelativeLayout>
這對我來說
相關問題
- 1. 我怎樣才能把滾動在我的iPhone視圖?
- 2. 我怎樣才能把一個酒吧旁邊的滾動條
- 3. 我怎樣才能把導航項目的title屬性
- 4. 我怎樣才能把GridView的行
- 5. 我怎樣才能安裝盾項目
- 6. 我怎樣才能把我的本地LARAVEL項目的github公共倉庫
- 7. 我怎樣才能簽出已經下載的項目
- 8. 我怎樣才能把插在VAR
- 9. 我怎樣才能把它變成shellcode?
- 10. 我怎樣才能把「子類」一類
- 11. 我怎樣才能把我的WAMP只在網上對某些項目
- 12. 我怎樣才能把驗證下面的字段
- 13. 我怎樣才能把我的ImageButton的值,以C#功能
- 14. 怎樣才能把一個項目下的網格系統(調整大小)
- 15. 我怎樣才能把滾動條到摺疊式菜單中的jQuery
- 16. 我怎樣才能繼續正常滾動滾動溢出DIV
- 17. 我怎樣才能讓下BackgroundWorker的
- 18. 我怎樣才能得到我的項目中的實例
- 19. 我怎樣才能讓我的HorizontalBarChart滾動?
- 20. 我怎樣才能讓我的UpdatePanel滾動?
- 21. 我怎樣才能讓我的程序滾動QTextEdit小部件
- 22. 我怎樣才能重新HttpURLConnection的
- 23. 我怎樣才能把文本下每個imagaview
- 24. 我怎樣纔能有獨立的滾動列的GridView
- 25. 我怎樣才能把數據從excel解析成模型?
- 26. 我怎樣才能把一個變量formulaire選項在javascript
- 27. 我怎樣才能不把東西應用到:第一項?
- 28. 我怎樣才能
- 29. 我怎樣才能
- 30. 我怎樣才能
共享我們的代碼,請 – the100rabh