Android中如何實(shí)現(xiàn)TeaScreenPopupWindow多類型篩選彈框功能

這篇文章主要介紹了Android中如何實(shí)現(xiàn)TeaScreenPopupWindow多類型篩選彈框功能,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名與空間、虛擬空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、五通橋網(wǎng)站維護(hù)、網(wǎng)站推廣。

引入module

allprojects { repositories {  google()  jcenter()  maven { url 'https://www.jitpack.io' } }}implementation 'com.github.YangsBryant:TeaScreenPopupWindow:1.0.2'

主要代碼

public class MainActivity extends AppCompatActivity { @BindView(R.id.button) Button button; @BindView(R.id.button2) Button button2; private ScreenPopWindow screenPopWindow; private List<FiltrateBean> dictList = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  setContentView(R.layout.activity_main);  ButterKnife.bind( this );  initParam();  initView(); } private void initView() {  button.setOnClickListener(new View.OnClickListener() {   @Override   public void onClick(View view) {    screenPopWindow = new ScreenPopWindow(MainActivity.this, dictList);    //默認(rèn)單選,因?yàn)楣灿玫囊粋€(gè)bean,這里調(diào)用reset重置下數(shù)據(jù)    screenPopWindow.reset().build();    screenPopWindow.showAsDropDown(button);    screenPopWindow.setOnConfirmClickListener(new ScreenPopWindow.OnConfirmClickListener() {     @Override     public void onConfirmClick(List<String> list) {      StringBuilder str = new StringBuilder();      for (int i=0;i<list.size();i++) {       str.append(list.get(i)).append(" ");      }      Toast.makeText(MainActivity.this, str.toString(), Toast.LENGTH_SHORT).show();     }    });   }  });  button2.setOnClickListener(new View.OnClickListener() {   @Override   public void onClick(View v) {    screenPopWindow = new ScreenPopWindow(MainActivity.this, dictList);    //設(shè)置多選,因?yàn)楣灿玫囊粋€(gè)bean,這里調(diào)用reset重置下數(shù)據(jù)    screenPopWindow.setSingle(false).reset().build();    screenPopWindow.showAsDropDown(button2);    screenPopWindow.setOnConfirmClickListener(new ScreenPopWindow.OnConfirmClickListener() {     @Override     public void onConfirmClick(List<String> list) {      StringBuilder str = new StringBuilder();      for (int i=0;i<list.size();i++) {       str.append(list.get(i)).append(" ");      }      Toast.makeText(MainActivity.this, str.toString(), Toast.LENGTH_SHORT).show();     }    });   }  }); } private void initParam() {  String[] brand = {"花花公子", "語(yǔ)克","優(yōu)衣庫(kù)", "美特斯邦威", "森馬", "翰代維", "PUMA"};  String[] type = {"男裝", "T恤", "運(yùn)動(dòng)服", "女裝", "童裝", "緊身衣"};  FiltrateBean fb1 = new FiltrateBean();  fb1.setTypeName("品牌");  List<FiltrateBean.Children> childrenList = new ArrayList<>();  for (String aBrand : brand) {   FiltrateBean.Children cd = new FiltrateBean.Children();   cd.setValue(aBrand);   childrenList.add(cd);  }  fb1.setChildren(childrenList);  FiltrateBean fb2 = new FiltrateBean();  fb2.setTypeName("類型");  List<FiltrateBean.Children> childrenList2 = new ArrayList<>();  for (String aType : type) {   FiltrateBean.Children cd = new FiltrateBean.Children();   cd.setValue(aType);   childrenList2.add(cd);  }  fb2.setChildren(childrenList2);  dictList.add(fb1);  dictList.add(fb2); }}

TeaScreenPopupWindow屬性大全

方法屬性
setTopView(Boolean bl, int color)設(shè)置頂部分割線是否顯示,以及顏色。默認(rèn)true,#f3f3f3
setBottomView(Boolean bl, int color)設(shè)置底部分割線是否顯示,以及顏色。默認(rèn)true,#f3f3f3
setConfirm(String text, int size, int textColor, int color)設(shè)置確定按鈕的文字,字體大小,字體顏色,背景顏色。默認(rèn)“確定”,14,#ffffff,#0aa666
setReset(String text, int size, int textColor, int color)設(shè)置重置按鈕的文字,字體大小,字體顏色,背景顏色。默認(rèn)“重置”,#000000,#ffffff
setAlpha(int mAlpha)設(shè)置陰影層的透明度 默認(rèn)是0.5f
setTitleColor(int color)設(shè)置title的字體顏色,默認(rèn)#000000
setTitleSize(int size)設(shè)置title的字體大小,默認(rèn)14
setRadius(int radius)設(shè)置item圓角大小,默認(rèn)12
setStrokeWidth(int width)設(shè)置item邊框粗細(xì),默認(rèn)2
setStrokeColor(int color)設(shè)置item邊框顏色,默認(rèn)#0aa666
setBoxWidth(int width)設(shè)置item寬度,默認(rèn)是200dp
setBoxHeight(int height)設(shè)置item高度,默認(rèn)是WRAP_CONTENT
setChecked(String color)設(shè)置item選中時(shí)的顏色,默認(rèn)#0aa666
setEnabled(String color)設(shè)置item未選中時(shí)的顏色,默認(rèn)#000000
setBoxSize(int size)設(shè)置item字體大小,默認(rèn)13
setSingle(boolean bl)設(shè)置是否開(kāi)啟單選,默認(rèn)單選
reset()顯示控件時(shí)數(shù)據(jù)重置
build()參數(shù)設(shè)置完畢,一定要build一下

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Android中如何實(shí)現(xiàn)TeaScreenPopupWindow多類型篩選彈框功能”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!

網(wǎng)頁(yè)標(biāo)題:Android中如何實(shí)現(xiàn)TeaScreenPopupWindow多類型篩選彈框功能
文章分享:http://bm7419.com/article48/phddhp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信小程序、ChatGPT、網(wǎng)站收錄、Google、企業(yè)網(wǎng)站制作外貿(mào)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)