【发布时间】:2011-11-11 16:09:58
【问题描述】:
我知道这听起来很容易。我需要将文本放在中心,但是当文本太长时,它需要放在下面,但仍然在我的 xml 的中心对齐。
这是我的代码:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/showdescriptioncontenttitle"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_centerHorizontal="true"
>
<TextView
android:id="@+id/showdescriptiontitle"
android:text="Title"
android:textSize="35dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
我放了 paddingTop 和 Bottom 因为我需要一些空间。 PS:我的代码更大;它在一个相对布局中。
【问题讨论】:
-
这里你没有使用任何文字样式
标签: java android xml text center