我想添加视图到我的LinearLayout
而不会阻塞UI。Android - 无阻挡UI的addView
@Override
protected void onPostExecute(RequestMySellingList result)
{
for (MySellingData data : result.data)
{
LinearLayout rowSelling = (LinearLayout) inflater.inflate(R.layout.row_selling_item, null);
ImageView iv_sellingItemImage = (ImageView) rowSelling.findViewById(R.id.iv_sellingItemImage);
iv_sellingItemImage.setImageBitmap(data.bitmap);
// Add rowSelling to the main list holder
ll_sellingList.addView(rowSelling);
}
}
注:ll_sellingList
是LinearLayout
持有条目
我不能用onProgressUpdate()
,因为我得到一个长隆JSON响应,我必须使用onPostExecute()
方法,得到充分的JSON请求。
的问题是,如果该请求是非常长的 - addView块的UI
runOnUiThread?你有没有尝试过,如果你使用它会更好一点。 – Tsunaze
为什么不使用listView?你可以让它更有效率。 BTW postExecute在UIThread上运行@Tsunaze – Devrim
我不使用listView,因为我使用的是ScrollView。 –