【发布时间】:2014-12-15 15:15:52
【问题描述】:
我想知道你能不能帮我做点什么。我有一个相对布局,顶部有一个 imageview。在相对布局周围我有一个边框(layout_bg.xml)。正如您从我附加的图像中看到的那样,边框不会在图像周围继续,这就是我想要它做的。我知道我在这里需要一些额外的代码,但由于我对 java 很陌生,所以我无法弄清楚或在线找到解决方案,我希望你能帮助我或为我指明正确的方向。
我想做什么:
使图像适合我的框架,但带有边框和圆形的左上角和右上角。
图片
layout_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<corners android:radius="8dp"/>
<stroke android:width="3dp" android:color="#50A4A4A4" />
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>
item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:geekui="http://schemas.android.com/apk/res-auto"
android:background="@drawable/layout_bg"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="70dp">
<ImageView
android:id="@+id/imageView_player"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="225dp"
android:layout_alignParentTop="true" />
</RelativeLayout>
【问题讨论】: