【发布时间】:2013-04-23 11:39:50
【问题描述】:
如何在Layout 中水平居中对齐ListView 的文本项?
老实说,在提出这样一个基本问题之前,我至少搜索了一个小时。
谢谢。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint="Remind..." />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:baselineAligned="false"
android:orientation="horizontal" >
<ListView
android:id="@+id/listviewTimeInterval"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:scrollbars="none" />
<-- . . . --/>
<-- more lists of the same kind--/>
<-- . . .--/>
</LinearLayout>
</LinearLayout>
【问题讨论】:
-
不应该在自定义项 XML 中设置
TextViews的gravity吗?
标签: android android-layout android-widget