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

Add Percentage Offset attribute #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ allprojects {

### Eclipse

import it as a library project.
Import it as a library project.


## How to use it

you can define a slideswitch in xml like the following example
You can define a slideswitch in a layout xml using the following example


```xml
Expand All @@ -53,13 +53,13 @@ you can define a slideswitch in xml like the following example
android:layout_height="120dip"
slideswitch:isOpen="false"
slideswitch:shape="circle"
slideswitch:themeColor="#f200aa96" >
</com.leaking.slideswitch.SlideSwitch>
slideswitch:offsetPercent="0.65"
slideswitch:themeColor="#f200aa96"/>
```



you can initial the state(on or off) in jave code in this way
You can initial the state (on or off) in Java code using the following method


```java
Expand Down
2 changes: 2 additions & 0 deletions SlideSwitch/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<declare-styleable name="slideswitch">
<attr name="themeColor" format="color" />
<attr name="isOpen" format="boolean" />
<attr name="offsetPercent" format="float"/>
<attr name="shape">
<enum name="rect" value="1" />
<enum name="circle" value="2" />
</attr>
</declare-styleable>


</resources>
Loading