【发布时间】:2013-08-18 00:13:48
【问题描述】:
我在相对布局中对齐 2 个图像视图时遇到问题:
这 2 个图像需要靠近才能在没有空间的情况下相互连接。像这样:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_portrait"
android:orientation="vertical" >
<!-- header -->
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:src="@drawable/header" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/dia1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:src="@drawable/dia1" />
<ImageView
android:id="@+id/dia2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/dia1"
android:contentDescription="@string/desc"
android:src="@drawable/dia2" />
</RelativeLayout>
我做错了什么?
【问题讨论】:
-
你也可以上传你的图片吗?如果你的图像是在一条直线上裁剪的......那么两个可能的问题可能是...... 1.如果你的drawables有额外的透明空间,正如我在第一张图片中看到的那样,需要删除它。 2. 如果裁剪后问题仍然存在,那么最好将 Imageview 背景设置为不是 src。
-
您能否用整个布局更新您的问题,并更好地指出哪个
drawable是哪个?
标签: java android xml layout android-relativelayout