我想顯示使用抽屜XML文件中的android創建自定義形狀內部ImageView的。 Iv'e在網上搜索了幾個星期,但沒有結果。我找到的唯一答案是使用常規形狀(圓形,矩形)或在圖層中使用xml(將圖像作爲背景),但圖像是從服務器動態顯示的。如何插入的ImageView到自定義XML形狀
這是圖像視圖
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/upload_newdish_icon"
android:layout_below="@+id/dish_name_et"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:id="@+id/imageView2" />
這是自定形狀
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="70dp" android:height="70dp" android:viewportHeight="700.000000" android:viewportWidth="700.000000">
<group android:scaleX="0.100000" android:scaleY="-0.100000" android:translateY="700.000000">
<path android:fillColor="@color/colorPrimary" android:pathData="M3065 6779 c-632 -31 -1270 -127 -1895 -285 -274 -70 -351 -105 -455 -209 -104 -104 -139 -181 -209 -455 -145 -574 -232 -1117 -278 -1745 -19 -256 -16 -979 6 -1245 46 -580 135 -1128 271 -1665 71 -280 105 -355 210 -460 104 -104 181 -139 455 -209 544 -137 1088 -226 1670 -273 301 -24 1019 -24 1320 0 582 47 1126 136 1670 273 274 70 351 105 455 209 104 104 139 181 209 455 145 574 232 1117 278 1745 19 256 16 979 -6 1245 -46 580 -135 1128 -271 1665 -71 280 -105 355-210 460 -104 104 -181 139 -455 209 -914 231 -1864 329 -2765 285z"/>
</group>
</vector>
添加一些代碼,你做了什麼這麼遠嗎? – jagapathi