andriod用布局输出自己的基本信息要怎么做?

比如自己名字,性别和电话号码,在textview中用text输出但是我不知道怎么转行,就是输出自己名字以后转行然后输出自己性别,而且要对齐,我在每一句的后面加一个/n但没有对齐,刚开始学,期望解惑图片说明

1、换行使用"\n",不是"/n"。

代码如下

StringBuilder builder = new StringBuilder();
builder.append("张三").append("\n");
builder.append("男").append("\n");
textView.setText(builder.toString());

2、为什么建议使用StringBuilder而不是String:http://blog.csdn.net/wanghang1208/article/details/49764245

\n换行,但是建议你每个字段用一个单独的控件。

在安卓里一般不会采用\n换行来显示多个字段,一般就是有几条信息,定义几个控件。你要输出名字性别和电话号码,最好定义三个TextView,
就会对齐了,这样也便于你以后调整格式。

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:background="@android:color/white"
        android:padding="8dp"
        android:id="@+id/name"
        android:text="姓名"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_marginTop="2dp"
        android:layout_marginBottom="2dp"
        android:background="@android:color/white"
        android:padding="8dp"
        android:id="@+id/sex"
        android:text="性别"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <TextView
        android:background="@android:color/white"
        android:padding="8dp"
        android:id="@+id/phone"
        android:text="电话号码"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>