這就是我的成就。使用inset
可繪製的,我們可以實現這個輕鬆和更多的定製,我們可以用更少的代碼來完成。使用此twoside_border.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- inset: It can remove border from any other side-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetBottom="-15dp"
android:insetRight="-15dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rectangle">
<stroke
android:width="20dp"
android:color="#ED302F" />
<!--<corners
android:topLeftRadius="20dp"
/>-->
<!--<solid android:color="#f50a0a" />-->
</shape>
insetBottom
& insetRight
-dp值有助於隱藏的邊界,我們並不需要,並作爲輸出:
two side border image
以獲得角球曲線刪除上面代碼中的註釋行
<corners android:topLeftRadius="20dp"/>
現在我們可以看到類似下面我怎麼&根據您的需要調整填充或利潤率曲線彎曲
border with curve image
使用此xml
在frame layout
,使其適合邊框內圖像看起來像一個框架。
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:scaleType="centerCrop"
android:src="@drawable/your_image_file" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/twoside_border" />
</FrameLayout>
@pindol 你檢查它,它的測試,並與我一起工作 –
沒有對我來說doesen't工作,這裏是我所看到的:http://mattialori.net/imageview.png – pindol
@pindol請檢查更新回答 –