Codenameone 加载要工作的文本动画要求
我指的是本教程的代码示例: 这些示例使用的是Codenameone 加载要工作的文本动画要求,codenameone,Codenameone,我指的是本教程的代码示例: 这些示例使用的是BorderLayout,但是LoadingTextAnimation示例使用的是BoxLayout.y()。我怀疑问题在于要用动画占位符替换的组件的最小高度 例如,以下代码不起作用: Form f = new Form("Hello", BoxLayout.y()); Label profileText = new Label(); profileText.setText("placeholder");
BorderLayout
,但是LoadingTextAnimation
示例使用的是BoxLayout.y()
。我怀疑问题在于要用动画占位符替换的组件的最小高度
例如,以下代码不起作用:
Form f = new Form("Hello", BoxLayout.y());
Label profileText = new Label();
profileText.setText("placeholder");
f.add(profileText);
LoadingTextAnimation.markComponentLoading(profileText);
f.show();
但这很好:
Form f = new Form("Hello", BoxLayout.y());
Label profileText = new Label(){
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
int mm = CN.convertToPixels(1);
Log.p(dim.toString() + " -> width = " + (dim.getWidth() / mm) + " height = " + (dim.getHeight() / mm));
dim.setHeight(CN.convertToPixels(10));
Log.p(dim.toString() + " -> width = " + (dim.getWidth() / mm) + " height = " + (dim.getHeight() / mm));
return dim;
}
};
profileText.setText("placeholder");
f.add(profileText);
LoadingTextAnimation.markComponentLoading(profileText);
f.show();
玩dim.setHeight(CN.convertToPixels(…)代码>,我发现最小高度应该是10毫米左右。是这样吗?若有,原因为何?还是有其他要求?Javadoc没有提到这一点
感谢您的解释。我对LoadingTextAnimation进行了一些调整,以使用它所替换标签的字体大小和填充,这似乎纠正了问题。修复此问题的提交是