我需要在android中创建这个特定形状的imageview。如果可以裁剪这个形状的图像,那么它也很好。请帮帮我好吗?
khbbv19g1#
这是整套的
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/imageView" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:src="@drawable/gohan" /> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" android:src="@drawable/triangle_shape" /></FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/gohan" />
android:src="@drawable/triangle_shape" />
</FrameLayout>
triangle_shape.xml这将在您的 drawable 目录
drawable
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:fromDegrees="-70" // you will have to tweak this a little for adjustment android:pivotX="100%" android:pivotY="75%" android:toDegrees="40"> <shape android:shape="rectangle"> <stroke android:width="10dp" android:color="@android:color/transparent" /> <solid android:color="@android:color/holo_blue_bright" /> </shape> </rotate> </item></layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="-70" // you will have to tweak this a little for adjustment
android:pivotX="100%"
android:pivotY="75%"
android:toDegrees="40">
<shape android:shape="rectangle">
<stroke
android:width="10dp"
android:color="@android:color/transparent" />
<solid android:color="@android:color/holo_blue_bright" />
</shape>
</rotate>
</item>
</layer-list>
输出
1条答案
按热度按时间khbbv19g1#
这是整套的
triangle_shape.xml这将在您的
drawable
目录输出
