Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java TextView中的换行符添加了填充_Java_Android_Textview_Padding - Fatal编程技术网

Java TextView中的换行符添加了填充

Java TextView中的换行符添加了填充,java,android,textview,padding,Java,Android,Textview,Padding,这是我的文本视图: 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

这是我的文本视图:

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"));
其中“\nInfo”将被稍后的内容替换。当我运行此程序时,我得到以下结果:

d
 Info
data
    Info
dev
   Info
system
      Info

如何去掉信息左侧的填充,使它们从同一个位置开始?

谢谢你的回答,但运气不好。。。它仍然凹凸不平。
this.directoryEntries.add(new IconifiedText(currentFile
                    .getPath(), currentIcon, "\r\nInfo"));