Line break in TextView adds padding
This is my 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));
}
And when i call the object I have:
this.directoryEntries.add(new IconifiedText(currentFile
.getPath(), currentIcon, "\nInfo"));
Where "\nInfo" will be replaced by something later. When i run this, I get this:
d
Info
data
Info
dev
Info
system
Info
How do i get rid of this padding to the left of Info so they both start at the same place?
this.directoryEntries.add(new IconifiedText(currentFile
.getPath(), currentIcon, "\r\nInfo"));
精彩评论