Open nidhinprathap opened 7 years ago
I believe you should use a custom shape for the moving part of the button. Did you try to do that?
i added it as an image.. my issue is how to color the background of the swiped area while swipping
I see. This library doesn't support this behavior right now. You can add this functionality in a pull request, if you have time. If think it is a really nice behavior, I will add this in the future.
Hello @nidhinprathap. A trailing effect was added by @rahulk11 in the version 0.8.0. You can use this version to achieve the behavior that you need. But there's still a problem with the corners of the button during the slide, so I won't close this issue.
The problem was solved in the version 0.8.1
I reopened this issue as this is not only a feature request...
@nidhinprathap Try to use the new functionalities of the button to achieve the behavior that you need. Please let me know if the trailing effect solves your problem.
Somewhat does the part. Here is a bug fix :
SwipeButton.java
function setTrailingEffect
its crashing if no trailingDrawable has been assigned.
Just add this and declare trailingDrawable class level;
private void setTrailingEffect() {
if (trailEnabled && trailingDrawable != null && layer != null) {
layer.setVisibility(View.VISIBLE);
layer.setLayoutParams(new RelativeLayout.LayoutParams(
(int) (swipeButtonInner.getX() + swipeButtonInner.getWidth()),
swipeButtonInner.getHeight()));
}
}
@nidhinprathap I believe that the developers would be confused when they set the trail effect to true and nothing happens. Instead of checking for null only in the execution of the animation, I am now throwing an exception in the creation of the button with an easy to understand message asking for the drawable. This is available in the 0.8.2 version.
Ok great.
Or u can just used button_background
,
if button_trail_drawable
is not specified and if button_trail_enabled
is enabled
This seams good. I will take look at this later.
Now it doesn't throw the error anymore. It uses the background from the button if the trailing background is not set.
this. Plus on slide the slided areas color should change to the buttons color.
Can u guide me in this