Diamond Shape Android

时间:2016-07-07 18:36:52

标签: android xml android-layout android-drawable xml-drawable

我想像这样的背景制作钻石形状

enter image description here

1-我试图将视图旋转45度,但它变成了haxagon(为什么?我不明白)

ObjectAnimator animator = ObjectAnimator.ofFloat(iv21,"rotation",0,45);
        animator.start();

2-我从库中尝试过DiamondImageView,但它将视图显示为菱形,但是当我点击它时它的原始位置保持不变。

 <com.github.siyamed.shapeimageview.DiamondImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        app:siBorderType="fill"
        android:id="@+id/iv1"
        app:siBorderWidth="2dp"
        app:siBorderColor="@color/colorPrimary"
        android:src="@drawable/logo"
        />

所以如果可以使用drawable xml进行布局,那将是非常好的。

0 个答案:

没有答案