2011-02-09 78 views
0

這是我的TextView:斷行添加填充

public IconifiedTextView(Context context, IconifiedText aIconifiedText) { 
    super(context); 

    /* 
    * First Icon and the Text to the right (horizontal), not above and 
    * below (vertical) 
    */ 
    this.setOrientation(HORIZONTAL); 

    mIcon = new ImageView(context); 
    mIcon.setImageDrawable(aIconifiedText.getIcon()); 
    // left, top, right, bottom 
    mIcon.setPadding(0, 3, 7, 3); // 5px to the right 

    /* 
    * At first, add the Icon to ourself (! we are extending LinearLayout) 
    */ 
    addView(mIcon, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 

    mText = new TextView(context); 
    mText.setText(aIconifiedText.getText()); 
    mText.setTextSize(16); 
    /* Now the text (after the icon) */ 
    addView(mText, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 


    mInfo = new TextView(context); 
    mInfo.setText(aIconifiedText.getInfo()); 
    /* Now the Info (below the Text) */ 
    addView(mInfo, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 
} 

當我調用這個對象,我有:

this.directoryEntries.add(new IconifiedText(currentFile 
        .getPath(), currentIcon, "\nInfo")); 

其中「\ n信息」將通過稍後的東西來代替。當我運行這個,我得到這個:

d 
Info 
data 
    Info 
dev 
    Info 
system 
     Info 

我如何擺脫信息左側的這種填充,使他們都在同一個地方開始?

回答

0
this.directoryEntries.add(new IconifiedText(currentFile 
        .getPath(), currentIcon, "\r\nInfo")); 
+0

感謝您的答案,但沒有運氣......它仍然縮進。 – 2011-02-09 19:55:43