【问题标题】:How to create hexagonal imageview in android? [duplicate]如何在android中创建六边形imageview? [复制]
【发布时间】:2016-06-30 11:31:40
【问题描述】:

我对android很陌生,谁能告诉我如何在图像中创建六边形视图。

【问题讨论】:

  • 尝试使用路径类和 porterduff

标签: android imageview


【解决方案1】:

Shape Image View 可以帮助您满足您的要求

<com.github.siyamed.shapeimageview.{ClassName}
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:layout_margin="8dp"
   android:src="@drawable/neo"
   app:siBorderWidth="8dp"
   app:siBorderColor="@color/darkgray"/>

在您的情况下,您可以使用com.github.siyamed.shapeimageview.HexagonImageView

还有很多其他可用的形状,请参阅该库以获取更多详细信息。

也看看CustomShapeImageView

【讨论】:

  • 感谢您的回答。但是我怎样才能像在图像中一样旋转它
  • 您可以使用ImageViewandroid:rotation 属性,因为HexagonImageView 也扩展了同一个类。
  • 你说得对,但是当我使用 android 旋转它时:rotation 它也会旋转图像
  • 在这种情况下,您需要使用库进行自定义。
  • 你能帮帮我吗?
猜你喜欢
  • 2013-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-26
  • 2014-05-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多