我需要顯示一個標籤列表,但一些標籤可能位於多行。所以我創建了一個沿着Y軸的BoxLayout的可滾動容器,並試圖使用SpanLabels,但它看起來像一個普通的標籤。我錯過了什麼嗎?在帶有BoxLayout的沿着y軸的Codename one中的SpanLabel不能跨越
1
A
回答
0
因此,我創建一個滾動容器的BoxLayout沿y軸並試圖利用SpanLabels,但它顯示爲普通標籤。我錯過了什麼嗎?
這是不工作的關鍵。我調用了container.setScrollable(true),它使得它可以在x和y中滾動,所以儘管我使用了SpanLabel,但它仍然顯示在一行上,因爲它可以水平滾動。這個:
this.container.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
this.container.setScrollableY(true);
this.container.setScrollableX(false);
固定它給我。
0
Form f = new Form("Span", BoxLayout.y());
f.add(new SpanLabel("Short"));
f.add(new SpanLabel("Not so short"));
f.add(new SpanLabel("Not so long as to line break"));
f.add(new SpanLabel("This should totally line break because it's getting to that length where it should have an effect"));
f.add(new SpanLabel("Short"));
f.add(new SpanLabel("Not so short"));
f.add(new SpanLabel("Not so long as to line break"));
f.add(new SpanLabel("This should totally line break because it's getting to that length where it should have an effect"));
f.show();
相關問題
- 1. Codename One BoxLayout scroll
- 2. 沿着x軸和y軸旋轉
- 3. 沿着X軸和Z軸的等距運動在Unity中沒有沿Y軸移動
- 4. Matlab:沿Y軸的ylabel
- 5. Core-Plot [沿着Y軸的CPTAxis的標題定位]
- 6. 將Y軸沿着x = 0線放在散景圖中
- 7. 與Codename one中的HTTPClient功能相同
- 8. Codename One中的DNS問題
- 9. Codename One - Dropbox 2中的Json
- 10. Selection.setSelection不能跨越
- 11. 沿x軸線的Box2D的對象而重力在y軸上
- 12. 陰影沿Y軸有界區域
- 13. 在Codename One中使用FileChooser
- 14. ggplot2 - facet_grid:我如何能夠沿着Y軸有不同範圍的值,但零點是否對齊?
- 15. 沿着Z軸呈現HTML元素
- 16. 表的交叉表功能沒有攜帶沿着
- 17. Codename one builds failing
- 18. Codename One PDF API
- 19. Codename one GPS tracker
- 20. Codename one,Capture Audio
- 21. CodeName One IOS CaptureAudio
- 22. codename one augmented reality
- 23. Codename one image issue
- 24. Codename one Pointer Popup
- 25. FacebookConnect Codename one api
- 26. CodeName One Transitions
- 27. Codename one FacebookConnect
- 28. codename one picker object
- 29. Codename One .properties
- 30. Math class codename one