【发布时间】:2018-11-09 06:46:31
【问题描述】:
我发现如果我包含此代码productPrice.setText(MyLeanCloudApp.getInstance().userTotalCharge.getPriceRangeString(product, context));,我的gridview 将无法平滑滚动。
ArrayAdapter 类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View rowView = inflater.inflate(R.layout.searchcvc, parent, false);
TextView productPrice = rowView.findViewById(R.id.SearchCVC_productPrice);
// issue in here
productPrice.setText(MyLeanCloudApp.getInstance().userTotalCharge.getPriceRangeString(product, context));
return rowView;
}
MyLeanCloudApp 是扩展
Application的类userTotalCharge 是一个类的变量
我尝试使用Handler
Handler h = new Handler();
h.post(new Runnable() {
@Override
public void run() {
productPrice.setText(MyLeanCloudApp.getInstance().userTotalCharge.getPriceRangeString(product, context));
}
});
但是,还是不能流畅滚动。有什么建议吗?
【问题讨论】:
标签: android android-asynctask android-gridview android-handler