如何在Android的1.6或2創建列表視圖這樣的(因爲的renderScript,它只能在3或更高版本的,但我需要清單的工作在幾乎所有的機器人):安卓:垂直的ListView重疊的行
回答
我在drawChild中使用了Camera.setTranslate(x, 0, z)
,其中用於旋轉虛擬化的x位置被改變,用於重疊的z被改變。然後有重疊的問題,因爲最後一個項目在頂層,第一個在底層。所以,在onCreate()
方法稱爲this.setChildrenDrawingOrderEnabled(true)
和重寫protected int getChildDrawingOrder (int childCount, int i) {}
在那裏我可以爲中期,後期行更改訂單。 這個想法是由雷納德給出的,他在我的其他帖子中提出了關於幾乎相同的東西here。
我getChildDrawingOrder(INT,INT)實施得到重疊的,我需要:
@Override
protected int getChildDrawingOrder (int childCount, int i) {
int centerChild = 0;
//find center row
if ((childCount % 2) == 0) { //even childCount number
centerChild = childCount/2; // if childCount 8 (actualy 0 - 7), then 4 and 4-1 = 3 is in centre.
int otherCenterChild = centerChild - 1;
//Which more in center?
View child = this.getChildAt(centerChild);
final int top = child.getTop();
final int bottom = child.getBottom();
//if this row goes through center then this
final int absParentCenterY = getTop() + getHeight()/2;
//Log.i("even", i + " from " + (childCount - 1) + ", while centerChild = " + centerChild);
if ((top < absParentCenterY) && (bottom > absParentCenterY)) {
//this child is in center line, so it is last
//centerChild is in center, no need to change
} else {
centerChild = otherCenterChild;
}
}
else {//not even - done
centerChild = childCount/2;
//Log.i("not even", i + " from " + (childCount - 1) + ", while centerChild = " + centerChild);
}
int rez = i;
//find drawIndex by centerChild
if (i > centerChild) {
//below center
rez = (childCount - 1) - i + centerChild;
} else if (i == centerChild) {
//center row
//draw it last
rez = childCount - 1;
} else {
//above center - draw as always
// i < centerChild
rez = i;
}
//Log.i("return", "" + rez);
return rez;
}
我希望這篇文章將幫助別人在未來
截圖實際上幾乎是一樣的,因爲我在我的問題提到。我使用的α,所以重疊的項目是一點點透視:
@pengwang什麼demo?你的意思是截圖的結果? – 2012-04-25 10:57:24
是的,你是對的,你可以分享你的結果代碼截圖 – pengwang 2012-04-25 12:58:41
@PooLaS請給我的偏好鏈接,或發表您的班組長了解這件事情來實現。 – 2014-07-21 05:56:06
- 1. 安卓:layout_weight垂直的LinearLayout
- 2. mvc3 jqbargraph垂直軸重疊
- 3. 如何防止div的垂直重疊
- 4. 垂直地畫彩條 - 安卓
- 5. 垂直疊加
- 6. 安卓:RelativeLayout的alignParentBottom重疊與EditText上
- 7. 安卓ListView行亮點
- 8. 安卓:ListView中
- 9. 垂直滾動div無重疊父
- 10. 垂直浮動/重疊問題
- 11. 圖像重疊兩個div(垂直)
- 12. 垂直ListView顯示
- 13. 水平ListView中的垂直ListView
- 14. 安卓:保持的ListView
- 15. 安卓的ListView頭滾動
- 16. 安卓GSON的ListView填充
- 17. 安卓:垂直居中的TextView的LinearLayout中
- 18. 安卓活動admob橫幅重疊
- 19. TextView重疊安卓在視圖中
- 20. 安卓ListView公差
- 21. 水平和垂直滾動的圖片庫(安卓)
- 22. 垂直堆疊html元素
- 23. 垂直摺疊動畫
- 24. WPF Listview:垂直地垂下標題
- 25. RecyclerView或ListView垂直與WRAP_CONTENT
- 26. ListView不會滾動垂直
- 27. 垂直滾動,ListView與WinJS
- 28. 水平/垂直滾動ListView
- 29. 摺疊adjasent元素的垂直邊界?
- 30. Python的垂直堆疊不工作
任何想法如何處理呢? – 2012-04-19 11:39:49