diff --git a/README.md b/README.md index 3e18bc0..f7a054f 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,8 @@ Here are all the **FloatingActionButton**'s xml attributes with their **default app:fab_progress_indeterminate="false" app:fab_progress_max="100" app:fab_progress="0" - app:fab_progress_showBackground="true"/> + app:fab_progress_showBackground="true" + app:fab_progress_width="6dp"/> ``` All of these **FloatingActionButton**'s attributes has their corresponding getters and setters. So you can set them **programmatically**. diff --git a/library/src/main/java/com/github/clans/fab/FloatingActionButton.java b/library/src/main/java/com/github/clans/fab/FloatingActionButton.java index ea72dd2..e98384c 100755 --- a/library/src/main/java/com/github/clans/fab/FloatingActionButton.java +++ b/library/src/main/java/com/github/clans/fab/FloatingActionButton.java @@ -135,6 +135,7 @@ private void init(Context context, AttributeSet attrs, int defStyleAttr) { mProgressBackgroundColor = attr.getColor(R.styleable.FloatingActionButton_fab_progress_backgroundColor, 0x4D000000); mProgressMax = attr.getInt(R.styleable.FloatingActionButton_fab_progress_max, mProgressMax); mShowProgressBackground = attr.getBoolean(R.styleable.FloatingActionButton_fab_progress_showBackground, true); + mProgressWidth = attr.getDimensionPixelSize(R.styleable.FloatingActionButton_fab_progress_width, mProgressWidth); if (attr.hasValue(R.styleable.FloatingActionButton_fab_progress)) { mProgress = attr.getInt(R.styleable.FloatingActionButton_fab_progress, 0); @@ -1124,6 +1125,14 @@ public void setElevation(float elevation) { } } + public int getProgressBarWidth() { + return mProgressWidth; + } + + public void setProgressBarWidth(float width) { + mProgressWidth = Util.dpToPx(getContext(), width); + } + /** * Sets the shadow color and radius to mimic the native elevation. * diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index 6348758..0eec6e3 100755 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -25,6 +25,7 @@ +