我有以下布局。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/list_item_bottom">
<TextView android:id="@+id/list_item_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ViewStub android:id="@+id/stub_for_alt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/list_item_name"
android:layout="@layout/text_view_alt_name"/>
<ImageView android:id="@+id/list_item_dopinfo1_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/stub_for_alt_name"
android:src="@drawable/ic_released"/>
</RelativeLayout>
我希望ViewStub在TextView下面,ImageView在ViewStub下面。
已经填充了ViewStub的元素显示正常。但是没有填充ViewStub的元素中,TextView与ImageView重叠了。
我的布局出了什么问题?
更新:
我找到的唯一解决方案就是给ViewStub和相关的TextView相同的android:id
值。
LinearLayout
中?然后将其放置在中间。 - Hossein Shahdoost