在三星 I9003 上,当我滚动视图时,会导致图形噪音。可能是什么问题呢?
首先,我读取包含特定结构的 XML 文件,然后将该结构放入 arrayList。
对于 arrayList i Do 中的每个元素:
//这里有一个小图像,如 5px * 10px
tr = new TableRow(this);
ImageView triangle = new ImageView(this);
params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
params.gravity = 0x11;
params.span = 8;
triangle.setBackgroundResource(R.drawable.complex_grey_down);
triangle.setLayoutParams(params);
tr.addView(triangle);
tl.addView(tr, params);
// here goes main title of the row
tr = new TableRow(this);
child = new TextView(this);
child.setText(sn.getName());
params = new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
params.gravity = 0x11;
params.span = 8;
child.setTypeface(null, Typeface.BOLD);
child.setTextColor(res.getColor(R.color.text));
child.setLayoutParams(params);
tr.addView(child);
tl.addView(tr, params);
// here goes short note under the title
if (sn.getNote().length() > 0) {
tr = new TableRow(this);
child = new TextView(this);
child.setText(sn.getNote());
child.setTextSize(12);
child.setPadding(30, 5, 30, 10);
child.setTextColor(res.getColor(R.color.text));
child.setGravity(Gravity.CENTER);
params = new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
params.gravity = 0x11;
params.span = 8;
child.setLayoutParams(params);
tr.addView(child);
}
tl.addView(tr, params);
}
添加 10 多行后,该手机无法处理它。对于某些手机来说,这种结构是否过于复杂。并且使用具有多个文本视图和少量图像视图的表格布局和复杂行是此类内容的正确解决方案
好吧,我实现了 sackOfViewsAdapter,但它没有帮助。在同一三星手机应用程序无法正常工作。我注意到一件事,如果您在安装后第一次启动应用程序,一切正常,屏幕上没有延迟和图形“噪音”,但是当应用程序被强制关闭并重新启动时,所有这些奇怪的事情都会发生