【问题标题】:How to set different row height in listfield?如何在列表字段中设置不同的行高?
【发布时间】:2012-07-11 10:23:41
【问题描述】:

关闭。请参考here。谢谢

【问题讨论】:

  • 你做不到。您只能设置固定高度。

标签: blackberry listfield


【解决方案1】:

有一个未记录的方法setRowHeight(int row, int height)。但是没有人保证它会在下一次操作系统更新时出现。更多详情here.

像这样修改你的 TableRowManager:

private class TableRowManager extends Manager {
    private int row;

    public TableRowManager(int row) {
        super(0);
        setRow(row);
    }

    public void setRow(int row) {
        this.row = row;
    }

    ...
    ...

    public int getPreferredHeight() {
        return getRowHeight(row);
    }
}

【讨论】:

  • 你试过setRowHeight(int row, int height)方法了吗?
  • 我用这个 setRowHeight(x, int height)
  • 可能是因为: public int getPreferredHeight() {return getRowHeight();} 您可能应该使用当前行的高度。如果您已经获得实际宽度,我也不明白为什么要使用 preferredWidth。此外,每次调用 layout 也不是最优的。
  • 不明白。你想在哪里设置索引?
  • getRowHeight(index) in getPreferredHeight()
猜你喜欢
  • 1970-01-01
  • 2012-10-24
  • 2023-03-06
  • 1970-01-01
  • 1970-01-01
  • 2012-08-09
  • 1970-01-01
  • 1970-01-01
  • 2015-06-10
相关资源
最近更新 更多