• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

aNNiMON/PaperStyleWidgets: Android material-design widgets

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

aNNiMON/PaperStyleWidgets

开源软件地址(OpenSource Url):

https://github.com/aNNiMON/PaperStyleWidgets

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

PaperStyleWidgets

Maven Central Build Status

Widgets with material-like design for Android 2.2+

Includes:

  • PaperButton - flat button with ripple animation.

Paper Button

Paper Button 2

  • PaperSeekBar - seekbar with smooth animation.

Paper SeekBar

  • PaperProgressBar - horizontal progress bar (indeterminate and normal).

Paper ProgressBar

Usage

Gradle dependency

dependencies {
    compile 'com.annimon:paperstyle:1.1.0'
}

Button

Just type com.annimon.paperstyle.PaperButton instead of Button

<com.annimon.paperstyle.PaperButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button" />

or configure styles by add attributes

  • pw_backgroundColor - set button background color
  • pw_focusColor - set ripple color
  • pw_borderSize - set button border size (0 for remove border)
  • pw_borderColor - set border color
<com.annimon.paperstyle.PaperButton
    ...
    android:textColor="#FFFFFF"
    custom:pw_backgroundColor="#2196F3"
    custom:pw_focusColor="@color/focus"
    custom:pw_borderSize="0" />

or create button dynamically

Button button = new PaperButton(getContext());

or change styles dynamically

PaperButton button = new PaperButton(getContext());
button.setBackgroundColor(0xFF2196F3);
button.setFocusColor(getResources().getColor(R.color.focus));
button.setBorderColor(0x7F555555);
button.setBorderSize(convertDpToPx(2, getResources().getDisplayMetrics()));

SeekBar

<com.annimon.paperstyle.PaperSeekBar
    android:max="360"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    custom:pw_color="@color/red" />

Optional attribute pw_color changes seekbar color.

Programmatically create

SeekBar seekbar = new PaperSeekBar(getContext());

Change style

PaperSeekBar seekbar = new PaperSeekBar(getContext());
seekbar.setColor(getResources().getColor(R.color.red));

ProgressBar

Indeterminate state

<com.annimon.paperstyle.PaperProgressBar
    android:indeterminate="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

Normal state with primary and secondary progress

<com.annimon.paperstyle.PaperProgressBar
    android:progress="0"
    android:secondaryProgress="180"
    android:max="360"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    custom:pw_progressColor="#9C27B0"
    custom:pw_secondaryProgressColor="#779C27B0" />
  • pw_progressColor - set primary progressbar color
  • pw_secondaryProgressColor - set secondary progressbar color (if needed)

Create dynamically

ProgressBar progressbar = new PaperProgressBar(getContext());

Change style dynamically

PaperProgressBar progressbar = new PaperProgressBar(getContext());
progressBar.setProgressColor(0xFF9C27B0);
progressbar.setSecondaryProgressColor(0x779C27B0);



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap