【发布时间】:2017-08-04 13:39:08
【问题描述】:
我有一个包含 3 个孩子的相对布局。
- 第一个是 ImageView 封面。
- 第二个是ImageView头像中心在父级和
- 3rd 是头像下方和水平居中的 TextView 应用名称。
理论上它应该可以工作,但我的布局没有将文本放在头像下方。相对布局有什么问题?
P/S:android:layout_below="@+id/logo2" 和 android:layout_below="@id/logo2" 都试过了,但还是不行!
谢谢!
这是我的 xml 布局。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/android_apple"/>
<ImageView
android:id="@+id/logo2"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_centerInParent="true"
android:src="@drawable/default_avatar"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/logo2"
android:layout_centerHorizontal="true"
android:text="AAAAAAA"
android:textStyle="bold"/>
</RelativeLayout>
结果:
【问题讨论】:
标签: android android-layout android-relativelayout