【发布时间】:2014-05-14 14:51:44
【问题描述】:
我想在两个 NumberPickers 之间对齐包含“:”的 TextView,我还希望它位于 NumberPickers 的顶部,这样它就不会将 NumberPickers '推'到一边。目前这是我的包含 NumberPickers 和 TextView 的 LinearLayout 的 XML:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/timer">
<NumberPicker
android:id="@+id/numberPicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignCenter="@id/numberPicker1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textView"
android:text=":" />
<NumberPicker
android:id="@+id/numberPicker2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
这就是它在我的 IDE 预览中的样子:
我真的希望冒号垂直居中并“超过” NumberPickers,因此它们之间没有空格。任何帮助是极大的赞赏!
编辑:我现在在那里的“layout_alignCenter”不起作用,似乎没有做任何事情(是的,我凭空取出它)。
【问题讨论】:
标签: android xml layout center numberpicker