【发布时间】:2018-02-11 13:59:05
【问题描述】:
我不确定我做错了什么。垂直视图正是我想要的,但是水平视图变得扭曲了。如何强制 ImageView 尊重第一个 TextView 下方的对齐?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
tools:context="com.example.admin.firstcard.MainActivity">
<TextView
android:id="@+id/firstLine"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="It's been a..."
android:fontFamily="cursive"
android:textSize="40sp"
android:layout_alignParentTop="true"
android:layout_margin="5dp" />
<ImageView
android:id="@+id/dachshund"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="@drawable/dachshund"
android:layout_below="@id/firstLine"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/dachshund"
android:layout_alignParentRight="true"
android:fontFamily="cursive"
android:text="longgggggggggggg week"
android:textSize="40sp"
android:layout_margin="5dp" />
</RelativeLayout>
编辑:重新阅读我通过 alignBottom 发现的 Android 文档是不正确的属性。
【问题讨论】:
标签: android xml layout orientation