Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gradient as outer_color? #172

Open
simonklejnstrup opened this issue Mar 24, 2022 · 2 comments
Open

Use gradient as outer_color? #172

simonklejnstrup opened this issue Mar 24, 2022 · 2 comments

Comments

@simonklejnstrup
Copy link

I can only manage to set the outer_color to a color from the colors.xml file.

Is there any workaround so I can use a gradient as outer_color.

Thanks!

@cortinico
Copy link
Owner

That's not really possible as of today. outer_color is just a color. We should extend this to be a outer_drawable or so

@ttpho
Copy link

ttpho commented Jul 21, 2022

@simonklejnstrup I think you can set outer_color is transparent and set android:background of SlideToActView by
gradient

Screen Shot 2022-07-21 at 09 09 12

with gradient (main_header_selector.xml)

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:radius="35dp" />
            <gradient
                android:angle="90"
                android:startColor="#FFFF0000"
                android:endColor="#FF00FF00"
                android:type="linear" />
        </shape>
    </item>
</selector>

with layout

 <com.ncorti.slidetoact.SlideToActView
            app:slider_icon="@drawable/ic_baseline_arrow_forward_24_white"
            app:slider_icon_color="@color/white"
            android:background="@drawable/main_header_selector"
            android:layout_marginHorizontal="40dp"
            android:layout_width="250dp"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            app:area_margin="8dp"
            app:animation_duration="300"
            app:outer_color="@color/transparent"
            app:inner_color="#FF8F8F"
            app:border_radius="35dp"
            app:text=""
            app:slider_height="70dp"
            app:slider_locked="false" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants