回答
據我所知,您嘗試將ListView
以上,一個ScrollView
或GridView
另一GridView
爲HeaderView
此水平滾動。它似乎像添加幾個小部件,它們有自己的滾動事件處理。不知道這是否可能。
嘗試另一種方法,將GridView
更改爲HorizontalScrollView
,並將您的視圖A,B,C ..放在裏面。
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
Here, your views A, B, C...
</HorizontalScrollView>
查看此簡單佈局的示例:Scrollabale listview in both direction with header using Horizontal scrollview。
然後,如果你要滾動的內容,而是保持固定頭部分,請嘗試使用添加此佈局的含量高於用ViewGroup
容器(裏面的LinearLayout,RelativeLayout的或別的東西)的包括:
<RelativeLayout
... >
<include
android:layout="@layout/layout_horizontal_scrollview"
... >
<ListView
... >
</RelativeLayout>
這應該做的伎倆..
但如果你想,在森那時間,你的內容你的頭部分滾動,嘗試這種佈局添加爲HeaderView
(我只是嘗試這個,它的工作原理) :
創建
HorizontalScrollView
的頭:<HorizontalScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > Here, your views A, B, C... </HorizontalScrollView>
充氣這種佈局爲
HeaderView
:View header = View.inflate(this, R.layout.layout_horizontal_scrollview, null); listview.addHeaderView(header);
注:添加HeaderView
到GridView是不可能的,你可以用一個特殊的適配器(如HFGridView)來做到這一點。
是的,但headerview不是水平滾動 – user3401211
這個作品,只是試了一下! headerview有一個水平滾動,而你的列表有一個垂直滾動和你的標題滾動內容。你使用addHeaderView膨脹HorizontalScrollView,它可以工作。 – Fllo
撰寫它們(GridView
和ListView
)在RelativeLayout
或垂直取向LinearLayout
這種方式:
<?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" >
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/gridview" >
</RelativeLayout>
項的ListView由數據設置到適配器編程方式添加。
編輯(使能垂直和水平滾動): 試試這個How can I make my layout scroll both horizontally and vertically?。
- 1. 排序縱向和橫向圖像
- 2. 縱向視圖與橫向模式具有相同的寬度
- 3. 2D橫向滾動相機視圖
- 4. 縱向和橫向取向的Flex中的圖像列表上的一個圖像的一致視圖
- 5. UIScrollview縱向和橫向滾動ios
- 6. 具有縱向/橫向視圖的UITabBarController
- 7. 具有縱向和橫向圖像的UIBarButtonItem可能會顯示橫向的縱向圖像
- 8. Android相機在縱向和橫向模式下保存圖像
- 9. 定製橫向/縱向視圖
- 10. 流體圖像 - 縱向/橫向
- 11. iPad上的橫向視圖和縱向視圖之間的數據同步
- 12. 在WPF中同時支持橫向和縱向視圖
- 13. 創建一個雙列橫向和縱向滾動的活動
- 14. 合適的圖像(橫向和縱向)到方形縮略圖
- 15. 縱向和橫向滑動
- 16. 如何以橫向適應縱向圖像在縱橫比保持縱橫比
- 17. as3 filp位圖縱向和橫向
- 18. 從橫向視圖到縱向視圖的Android過渡
- 19. 從橫向視圖切換到iOS上的縱向視圖
- 20. 縱向佈局不會橫向滾動
- 21. iPhone SDK:方向(橫向和縱向視圖)
- 22. 如何在縱向和橫向視圖中顯示來自相同位置的圖像
- 23. Android橫向動態列表視圖
- 24. ipad的縱向和橫向視圖的兩個不同的視口
- 25. 用戶在縱向視圖時強制加載橫向視圖
- 26. 未能從縱向視圖跳轉到橫向視圖
- 27. xcode從縱向視圖導航到橫向視圖
- 28. Android UI - Android橫向滾動視圖
- 29. 在橫向和縱向視圖中旋轉的問題
- 30. UIBarButtonItem支持自定義視圖的縱向和橫向尺寸?
我不明白你的問題:你能稍微解釋一下你期望什麼,你嘗試了什麼,現在的行爲是什麼? – Fllo
我想創建演示用戶界面同樣的圖像附加,我使用scrollview,gridview和listview,但我創建標題(A B C像圖像)的gridview,部分「內容A」...我創建的列表視圖,但我不加入他們 – user3401211