gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.jeffyu0925:ProgressRoundButton:1.2.0-sdk'
}
you can define the button in xml like this:
<com.xiaochen.progressroundbutton.AnimDownloadProgressButton
android:id="@+id/anim_btn"
android:layout_width="match_parent"
android:layout_height="40dp"
app:progressbtn_background_color="@android:color/holo_orange_light"
app:progressbtn_background_second_color="@android:color/holo_green_light"/>
- If you want shadow and press effect,please use
AnimButtonLayout
instead ofAnimDownloadProgressButton
:
<com.xiaochen.progressroundbutton.AnimButtonLayout
android:id="@+id/anim_btn3"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="40dp"
app:progressbtn_background_color="@android:color/holo_blue_dark"
app:progressbtn_background_second_color="@android:color/darker_gray"
app:progressbtn_enable_gradient="true"
app:progressbtn_enable_press="true"/>
- You can also implement your own
ButtonController
,so that you can controller gradient effect;
The Customized properties are in the follow table:
Property | Format | Default |
---|---|---|
progressbtn_radius | float | half of the button height |
progressbtn_background_color | color | #6699ff |
progressbtn_background_second_color | color | Color.LTGRAY |
progressbtn_text_color | color | progressbtn_background_color |
progressbtn_text_covercolor | color | Color.WHITE |
progressbtn_enable_press | boolean | false |
progressbtn_enable_gradient | boolean | false |
The follow picture make a clear explanation:
open gradient
use AnimButtonLayout
Copyright 2015 cctanfujun
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.