【发布时间】:2020-10-02 18:30:11
【问题描述】:
我因此使用ShapeableImageView:
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/myImage"
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:src="@drawable/larry"
app:strokeColor="@color/red"
app:strokeWidth="9dp"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.CornerCircle" />
而且画得还不错。但是,我希望视图和笔划之间有一点间距。我试过android:padding="10dp",但这似乎不起作用。
我也尝试过移除描边属性并使用这个可绘制资源来设置视图的背景:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="9dp"
android:color="#00FF00" />
</shape>
但边框根本没有出现。
请问,您知道我有什么方法可以实现吗?
【问题讨论】:
标签: android view android-imageview material-components-android