android - RelativeLayout 背景图像未填充其布局

标签 android xml android-layout android-image android-relativelayout

它是这样显示的---

enter image description here

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="178dp"
    android:orientation="vertical"
    android:background="@mipmap/background_poly"
    android:scaleType="fitXY"
    android:weightSum="1">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:orientation="vertical"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true">

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:textColor="#ffffff"
        android:text="Xxxxx Xxxx"
        android:textSize="14sp"
        android:textStyle="bold"

        />

    <TextView
        android:id="@+id/email"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#ffffff"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="5dp"
        android:text="xxxxxxxx@xxxx.com"
        android:textSize="14sp"
        android:textStyle="normal"

        />
</LinearLayout>

<de.hdodenhof.circleimageview.CircleImageView
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:src="@mipmap/aka"
    android:layout_marginLeft="16dp"
    android:layout_marginTop="38dp"
    android:id="@+id/circleView"
    />
</RelativeLayout>

我希望背景图像完全填充相关布局。

我尝试将 scaleType 用于 **fitXY 、center_crop ** 等

我什至尝试在 RelativeLayout 中添加一个 ImageView 并将其设置如下

<ImageView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:scaleType="centerCrop"
        android:src="@drawable/background" />

没用...

感谢帮助,谢谢...

最佳答案

这是你的背景图片问题。因为背景图像在边界处包含透明度。 从边框中删除透明阴影效果或更改图像,您的问题将解决。

关于android - RelativeLayout 背景图像未填充其布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36151410/

相关文章:

java - 动态添加LinearLayout到ListView中

android - 我可以在图形布局编辑器中预览操作栏吗?

android - 如何堆叠布局和透明(类和xml)

android - 协程在取消时注销接收者

xml - 在 XML/Xpath 中转义引号的具体问题

java - 返回空 NodeList 的命名空间感知文档

java - addRule(RelativeLayout.BELOW, id) 不起作用

java - 如何检查自动旋转屏幕设置是否在 Android 4.0+ 中打开/关闭

android - 在后台运行 Android phonegap 应用程序

.net - .Net 中是否有一种方法可以通过现有的 XML 文件以编程方式生成 DTD?