【发布时间】:2016-09-23 14:49:42
【问题描述】:
到目前为止,我能够做到这一点的方法是创建一个 XML 可绘制对象:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#00ffffff" />
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp" />
<corners android:radius="12dp" />
<stroke android:width="3dp" android:color="#ffffffff" />
</shape>
在我的布局 XML 中:
<FrameLayout
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="top|center_horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/profilePicture"
android:scaleType="fitXY"
android:clickable="true"
android:contentDescription="@string/content_desc_profile_picture" />
<ImageView
android:src="@drawable/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/content_desc_default_profile_picture" />
</FrameLayout>
我的问题是框架没有覆盖它后面可绘制的 profilePicture 的角落,从而使实际图像溢出边框。我怎样才能覆盖角落?真希望现在有一个类似 CSS 的属性!
【问题讨论】:
标签: java android xml imageview drawable