日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

android按钮变输入框动画,AnimShopButton 仿饿了么加入购物车旋转控件 - 自带闪转腾挪动画 的按钮。自带海量可定制 UI 属性。在 Re @codeKK Android开源站...

發布時間:2024/9/27 Android 30 豆豆

A shopping cart button with a telescopic displacement rotation animation ...

一個仿餓了么 帶伸縮位移旋轉動畫的購物車按鈕

注意,本控件非繼承自ViewGroup,而是純自定義 View,實現的仿餓了么加入購物車控件,自帶閃轉騰挪動畫的按鈕。

圖 1 項目中使用的效果,考慮到了View的回收復用,

并且可以看到在RecyclerView中使用,切換LayoutManager也是沒有問題的,

圖 2 Demo 效果,測試各種屬性值

圖 3 最新靜態圖

Article

相關博文:

想經濟上支持我 or 想通過視頻看我是怎么實現的:

Import

Step 1. Add the JitPack repository to your build file

Step 1. 在項目根 build.gradle 文件中增加 JitPack 倉庫依賴。

allprojects {

repositories {

...

maven { url "https://jitpack.io" }

}

}

Step 2. Add the dependency

dependencies {

compile 'com.github.mcxtzhang:AnimShopButton:V1.2.0'

}

Usage

xml:

android:id="@+id/btn1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:maxCount="3"/>

android:id="@+id/btn2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:count="3"

app:gapBetweenCircle="90dp"

app:maxCount="99"/>

android:id="@+id/btnEle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

app:addEnableBgColor="#3190E8"

app:addEnableFgColor="#ffffff"

app:hintBgColor="#3190E8"

app:hintBgRoundValue="15dp"

app:hintFgColor="#ffffff"

app:maxCount="99"/>

注意:

加減點擊后,具體的操作,要根據業務的不同來編寫了,設計到實際的購物車可能還有寫數據庫操作,或者請求接口等,要操作成功后才執行動畫、或者修改 count,這一塊代碼每個人寫法可能不同。

使用時,可以重寫onDelClick()和onAddClick()方法,并在合適的時機回調onCountAddSuccess()和onCountDelSuccess()以執行動畫。

效果圖如圖 2.

Attributes

name

format

description

中文解釋

isAddFillMode

boolean

Plus button is opened Fill mode default is stroke (false)

加按鈕是否開啟 fill 模式 默認是 stroke(false)

addEnableBgColor

color

The background color of the plus button

加按鈕的背景色

addEnableFgColor

color

The foreground color of the plus button

加按鈕的前景色

addDisableBgColor

color

The background color when the button is not available

加按鈕不可用時的背景色

addDisableFgColor

color

The foreground color when the button is not available

加按鈕不可用時的前景色

isDelFillMode

boolean

Plus button is opened Fill mode default is stroke (false)

減按鈕是否開啟 fill 模式 默認是 stroke(false)

delEnableBgColor

color

The background color of the minus button

減按鈕的背景色

delEnableFgColor

color

The foreground color of the minus button

減按鈕的前景色

delDisableBgColor

color

The background color when the button is not available

減按鈕不可用時的背景色

delDisableFgColor

color

The foreground color when the button is not available

減按鈕不可用時的前景色

radius

dimension

The radius of the circle

圓的半徑

circleStrokeWidth

dimension

The width of the circle

圓圈的寬度

lineWidth

dimension

The width of the line (+ - sign)

線(+ - 符號)的寬度

gapBetweenCircle

dimension

The spacing between two circles

兩個圓之間的間距

numTextSize

dimension

The textSize of draws the number

繪制數量的 textSize

maxCount

integer

max count

最大數量

count

integer

current count

當前數量

hintText

string

The hint text when number is 0

數量為 0 時,hint 文字

hintBgColor

color

The hint background when number is 0

數量為 0 時,hint 背景色

hintFgColor

color

The hint foreground when number is 0

數量為 0 時,hint 前景色

hingTextSize

dimension

The hint text size when number is 0

數量為 0 時,hint 文字大小

hintBgRoundValue

dimension

The background fillet value when number is 0

數量為 0 時,hint 背景圓角值

ignoreHintArea

boolean

The UI/animation whether ignores the hint area

UI 顯示、動畫是否忽略 hint 收縮區域

perAnimDuration

integer

The duration of each animation, in ms

每一段動畫的執行時間,單位 ms

hintText

string

The hint text when number is 0

數量為 0 時,hint 文字

replenishTextColor

color

TextColor in replenish status

補貨中狀態的文字顏色

replenishTextSize

dimension

TextSize in replenish status

補貨中狀態的文字大小

replenishText

string

Text hint in replenish status

補貨中狀態的文字

這么多屬性夠你用了吧。

Where to find me:

QQ 群 :557266366

History

Version : 1.1.0,Time: 2017/01/12

1 Feature : Add a boolean variable ignoreHintArea :The UI/animation whether ignores the hint area

2 Feature : Add a int variable perAnimDuration : The duration of each animation, in ms

Version : 1.2.0 Time: 2017/02/08

1 Feature : Add a status: replenishment.Click is not allowed at this time.

Judgment by setReplenish (boolean) and isReplenish ()

總結

以上是生活随笔為你收集整理的android按钮变输入框动画,AnimShopButton 仿饿了么加入购物车旋转控件 - 自带闪转腾挪动画 的按钮。自带海量可定制 UI 属性。在 Re @codeKK Android开源站...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。