欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android自定義View實(shí)現(xiàn)投票進(jìn)度條

 更新時(shí)間:2019年11月20日 11:04:38   作者:姜絲兒jlq  
這篇文章主要為大家詳細(xì)介紹了Android自定義View實(shí)現(xiàn)投票進(jìn)度條,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android投票進(jìn)度條的具體代碼,供大家參考,具體內(nèi)容如下

效果展示

功能屬性介紹

<!-- MatchSupportProgressBar -->
  <declare-styleable name="MatchSupportProgressBar">
  <!-- 進(jìn)度條圓角角度 -->
  <attr name="progress_radio" format="string"></attr>
  <!-- 進(jìn)度條左側(cè)Tag文本 -->
  <attr name="progress_tag_text" format="string"></attr>
  <!-- 進(jìn)度條已填充部分顏色 -->
  <attr name="progress_reach_color" format="color"></attr>
  <!-- 進(jìn)度條已填充部分高度 -->
  <attr name="progress_reach_height" format="dimension"></attr>
  <!-- 進(jìn)度條背景顏色 -->
  <attr name="progress_background_color" format="color"></attr>
  <!-- 進(jìn)度條背景高度 -->
  <attr name="progress_background_height" format="dimension"></attr>
  <!-- 進(jìn)度條左側(cè)Tag文本顏色 -->
  <attr name="progress_tag_text_color" format="color"></attr>
  <!-- 進(jìn)度條左側(cè)Tag文本尺寸 -->
  <attr name="progress_tag_text_size" format="dimension"></attr>
  <!-- 進(jìn)度條右側(cè)百分比文本顏色 -->
  <attr name="progress_percent_text_color" format="color"></attr>
  <!-- 進(jìn)度條右側(cè)百分比文本尺寸 -->
  <attr name="progress_percent_text_size" format="dimension"></attr>
  <!-- 進(jìn)度條右側(cè)百分比文本 -->
  <attr name="progress_percent_text" format="string"></attr>
  <!-- 進(jìn)度條選中的圖標(biāo)與進(jìn)度條、文字的間距 -->
  <attr name="progress_offsetX" format="dimension"></attr>
  <!-- 進(jìn)度條右側(cè)文字的水平偏移量 -->
  <attr name="progress_offsetR" format="dimension"></attr>
  <!-- 進(jìn)度條之間的偏移量 -->
  <attr name="progress_LineSpacing" format="dimension"></attr>
</declare-styleable>

xml使用示例

<com.yjyc.supportprogress.view.MatchSupportProgressBar
  android:id="@+id/progressbar_match_support"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_marginTop="10dp"
  android:paddingLeft="3dp"
  android:paddingRight="3dp"
  android:progress="30"
  yjcp:progress_background_color="#333"
  yjcp:progress_background_height="30dp"
  yjcp:progress_offsetR="20dp"
  yjcp:progress_percent_text_color="#345698"
  yjcp:progress_percent_text_size="13sp"
  yjcp:progress_reach_color="#999"
  yjcp:progress_tag_text_color="#ffffff"
  yjcp:progress_tag_text="杰倫;那英;汪峰"
  yjcp:progress_tag_text_size="13sp" />

java使用示例

//進(jìn)度條的點(diǎn)擊事件監(jiān)聽(tīng)
mspb.setOnRightTextClickListener(new OnRightTextClickListener() {

 @Override
 public void onClick(int position) {
 //position是點(diǎn)擊的位置
 }
});
/*
為進(jìn)度條賦值:
參數(shù)1:是我們算好的進(jìn)度值,一般由服務(wù)器返回。(注: yjcp:progress_tag_text="杰倫;那英;汪峰"設(shè)置 了幾個(gè)字符串,getPercentList就要傳幾個(gè)字符串)
參數(shù)2:得到一個(gè)boolean類型的集合,用于設(shè)置進(jìn)度條√顯示的位置
參數(shù)3:true表示已投票,false表示未投票
參數(shù)4:是否開(kāi)啟動(dòng)畫(huà)特效 
*/
mspb.setPercentState(getPercentList("10","90","100"), getCheckList(position), true, true);
//重置進(jìn)度條狀態(tài),如果在listview中涉及到復(fù)用問(wèn)題條用它即可。
//參數(shù):true投過(guò)票,false未投過(guò)
mspb.setState(false);

源碼下載:Android投票進(jìn)度條

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論