Strike animation over each image to indicate on / off modes. As can be seen in the material guidelines.
Size
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.DamonBaker:StrikedImageView:1.0.0'
}
practice
Set the attraction base as in a standard ImageView. It is recommended to set the android:tint
Feature so that the display knows in what color to tone the edge.
<xyz.damonbaker.strikedimageview.StrikedImageView
android:id="@+id/striked_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFC107"
app:srcCompat="@drawable/ic_camera_black_24dp"
app:striked="false" />
val strikedImage: StrikedImageView = findViewById(R.id.striked_image)
strikedImage.setImageDrawable(drawable)
editorial board isStriked
To apply the animation.
strikedImage.isStriked = true
Limitations
- StrikeedImageView works best with vector drawings, if you do not use vector drawing as the source of the image,
strikeColor
A feature must be set if you want the color of the fault to match the color of the painting. - Tone must be set in StrikeedImageView so that the display knows what color to tint StrikedImageView, otherwise you can set
strikeColor
Manually. - To simulate the clip-through effect of the alert, move the display hierarchy to the first parent with
ColorDrawable
available. This color will be used as a queuestrikeBackgroundColor
.- If the parent’s background is not an example of
ColorDrawable
(I.e. you can draw instead of color), then thestrikeBackgroundColor
The feature must be manually set.
- If the parent’s background is not an example of
.