我有ListView适配器,textview setLines不起作用。
在方法内:
public View getView(int position, View convertView, ViewGroup parent) {
我有这段代码:
holder.title.post(new Runnable() {
@Override
public void run() {
int lineCount = holder.title.getLineCount();
LogUtils.log("LINE_NUMBERS: " + lineCount+"");
if(lineCount == 2){
descriptionLineAmount = 6;
holder.description.setLines(descriptionLineAmount);
} else {
descriptionLineAmount = 4;
holder.description.setLines(descriptionLineAmount);
}
}
});
描述行号没有改变(单元格没有用额外的行更新)。
答案 0 :(得分:0)
在onclick中写这个: ViewHolder tagHolder =(ViewHolder)v.getTag();
然后使用tagHolder代替持有者