shot.gif
shot1.png
shot2.png
核心代碼主要是打包禮物按鈕的動(dòng)畫,分解下有三步
1,背景有四個(gè)三角形將按鈕不同方向圍住
2,絲帶不同方向連接到一起
3,蝴蝶結(jié)顯示,中間小圓有小變大
具體的代碼就不貼了,可以下載源碼看下
代碼下載
使用方式
compile 'com.ldoublem.GiftCard:giftcardlib:0.3'
<com.ldoblem.giftcardlib.GiftCardView
android:layout_width="300dp"
android:layout_height="200dp"
card:bgStartColor="#11cd6e"
card:buyButtonColor="#11cd6e"
card:cardBgColor="#33475f"
card:buttonByText="購買"
card:cardGiftTitle="禮物卡"
card:cardGiftLogo="@mipmap/ic_launcher"
card:buttonCheckText="確定"
card:checkButtonColor="#2c2c2c"
card:bgPackColor="#56abe4"
card:priceTextColor="#fff"/>
mGiftCardView = (GiftCardView) findViewById(R.id.gc_shop);
mGiftCardView.setMTitle("蘋果禮券");
mGiftCardView.setMPrice(188);
mGiftCardView.setButtonBuyText("買");
mGiftCardView.setButtonCheckText("確定");
mGiftCardView.setCardTip("請(qǐng)檢查你的購物單");
mGiftCardView.setCardBgColor(Color.BLACK);
mGiftCardView.setGiftLogo(R.mipmap.ic_launcher);
mGiftCardView.setBgStartColor(Color.BLACK);
mGiftCardView.setBgEndColor(Color.BLACK);
mGiftCardView.setBuyButtonColor(Color.BLACK);
mGiftCardView.setCheckButtonColor(Color.BLACK);
mGiftCardView.setPriceTextColor(Color.BLACK);
mGiftCardView.setBgPackBgColor(Color.BLACK);
mGiftCardView.setOnCheckOut(new GiftCardView.Buyer("陸先生", "中國(guó)浙江省",
"杭州市,西湖區(qū),南山路100號(hào)", "有效期:3天"),
new GiftCardView.OnCheckOut() {
@Override
public void Ok(int vid) {
}
});
代碼下載
如果覺得還不錯(cuò),就在github給我顆星星吧^^