2014-03-25 15 views
0

我有ListView适配器和textview setLines不工作。textView.setLines(int行)不适用于textview。

方法内:

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

您的XML中是否还有其他属性? –

+0

标题和说明的maxlines 2的行被设置为4。 – jimbob

回答

0

在onclick中写下: ViewHolder tagHolder =(ViewHolder)v.getTag();

然后代替持有人使用tagHolder

相关问题