我有以下布局,左边是1个图标,右边是2个文本视图(堆叠在彼此之上)。我希望text1垂直居中在面板中,当我使text2 Visible.GONE。你能告诉我我该怎么做?如何在一个线性布局中对齐图像垂直中心
<RelativeLayout android:id="@+id/panel"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight">
<ImageView
android:id="@+id/icon1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"/>
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/icon1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_gravity="center_vertical"/>
<TextView android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/icon1"
android:layout_below="@id/text1"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</RelativeLayout>
android:layout_alignParentTop =“true” - 这就是为什么 – 2010-01-22 02:37:00