原文地址:https://github.com/saiwu-bigkoo/Android-AlertView
仿iOS的AlertViewController 幾乎完美還原iOS 的 AlertViewController ,同時(shí)支持Alert和ActionSheet模式窗慎,每一個(gè)細(xì)節(jié)都是精雕細(xì)琢,并把a(bǔ)pi封裝成懶到極致模式哑舒,一行代碼就可以進(jìn)行彈窗.
compile 'com.bigkoo:alertview:1.0.3'
new AlertView("上傳頭像", null, "取消", null,
new String[]{"拍照", "從相冊(cè)中選擇"},
this, AlertView.Style.ActionSheet, new OnItemClickListener(){
public void onItemClick(Object o,int position){
Toast.makeText(this, "點(diǎn)擊了第" + position + "個(gè)",
Toast.LENGTH_SHORT).show();
}
}).show();
//或者builder模式創(chuàng)建
new AlertView.Builder().setContext(context)
.setStyle(AlertView.Style.ActionSheet)
.setTitle("選擇操作")
.setMessage(null)
.setCancelText("取消")
.setDestructive("拍照", "從相冊(cè)中選擇")
.setOthers(null)
.setOnItemClickListener(listener)
.build()
.show();
new AlertView("標(biāo)題", "內(nèi)容", null, new String[]{"確定"}, null, this,
AlertView.Style.Alert, null).show();