ceryle / SegmentedButton

Segmented Control with animation for Android API 12+
Apache License 2.0
363 stars 97 forks source link

How to add border? #2

Closed JasonHezz closed 8 years ago

JasonHezz commented 8 years ago

I tried to add background to SegmentedButtonGroup, however it wasn't work. Background code:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
  <corners android:radius="5dp"/>
  <stroke
      android:color="@color/colorPrimary"
      android:width="1dp"
      />
</shape>

Want to behave like this library android-segmented-control.

ceryle commented 8 years ago

Hi, I released a new version of the library. You can add these attributes to you code:

<co.ceryle.segmentedbutton.SegmentedButtonGroup
     ...
     app:sbg_borderSize="1dp"
     app:sbg_borderColor="@color/black" />
JasonHezz commented 8 years ago

Unfortunatly it still cannot work. image Here is my SegmentedButtonGroup code

<co.ceryle.segmentedbutton.SegmentedButtonGroup
        android:id="@+id/segmentedButtonGroup"
        android:layout_width="185dp"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dp"
        android:visibility="gone"
        app:sbg_animateSelector="accelerate"
        app:sbg_animateSelectorDuration="200"
        app:sbg_backgroundColor="@color/white"
        app:sbg_borderColor="@color/yancy_teal600"
        app:sbg_borderSize="1dp"
        app:sbg_dividerSize="0dp"
        app:sbg_position="0"
        app:sbg_radius="5dp"
        app:sbg_ripple="true"
        app:sbg_rippleColor="@color/yancy_teal600"
        app:sbg_selectorColor="@color/yancy_teal600"
        app:sbg_selectorTextColor="@color/white"
        app:sbg_shadow="false"
        >
        ....
</SegmentedButtonGroup>
ceryle commented 8 years ago

I released v1.1.1 and I believe it works now.

JasonHezz commented 8 years ago

Ok!Thank you for replying so quickly

ceryle commented 8 years ago

You're welcome. I’m happy to help.