【发布时间】:2015-09-18 19:48:11
【问题描述】:
我想将我的图像与屏幕底部对齐。作为我的应用程序条件,我必须将图像的 scaleType 设置为 matrix 。当我将 scaleType 应用于矩阵时,我真的不知道为什么我的图像在顶部。这是我的 xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_capture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom">
<FrameLayout
android:id="@+id/fl_camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom">
<ImageView
android:id="@+id/img_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="content_desc_overlay"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher"
/>
<ImageView
android:id="@+id/iv_overlay"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|center"
android:adjustViewBounds="true"
android:gravity="center_vertical"
android:scaleType="matrix"
android:src="@drawable/suit_1"
/>
<RelativeLayout
android:id="@+id/overlay_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:adjustViewBounds="true"
></RelativeLayout>
</FrameLayout>
</FrameLayout>
现在我在 ImageView id=iv_overlay 中设置图像,它应该位于 xml 中每个视图的顶部并且正在工作,iv_overlay Imageview 位于顶部但设置在屏幕的左上角.
它应该在屏幕底部的位置。所以请告诉我如何通过设置 scaleType 来实现这一点,我知道如果我删除 scaleType 那么它很容易与底部对齐。但由于某些原因,我必须使用 scaletype =Matrix。
编辑: 想看图的,这里是演示图,分辨率是 479*414 ,但我使用的是下面给出的这张图片是一个演示图片,很快就会从设计师那里得到更好的透明背景图片
【问题讨论】:
-
你能附上一张图片,这样我就可以确切地知道你想要什么
-
你想要什么?你想看看我想如何在视图中对齐图像吗?
-
显示布局图片
-
让我附上 ,,,,,,