最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android ViewPagerIndicator詳解及實(shí)例代碼

 更新時(shí)間:2017年05月02日 11:21:43   投稿:lqh  
這篇文章主要介紹了Android ViewPagerIndicator詳解及實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下

Android ViewPagerIndicator詳解及實(shí)例代碼

關(guān)于自定義View的屬性零碎知識(shí)

自定義View和自定義屬性的知識(shí)不再此提及,這里著重說的是屬性在自定義View中的獲取方式,自定義的屬性如下:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
 
  <declare-styleable name="Wisely"> 
    <attr name="wisely_1" format="boolean" /> 
    <attr name="wisely_2" format="boolean" /> 
    <attr name="wisely_3" format="boolean" /> 
    <attr name="wisely_4" format="boolean" /> 
  </declare-styleable> 
   
  <attr name="wisely_out" format="boolean" /> 
 
</resources> 

自定義View的相關(guān)代碼如下:

public CustomView(Context context, AttributeSet attrs) { 
  super(context, attrs); 
  TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Wisely); 
  typedArray.getBoolean(R.styleable.Wisely_wisely_1, true); 
  typedArray.recycle(); 
} 

重點(diǎn)看R.styleable.Wisely,它返回的是一個(gè)數(shù)組,而R.styleable.Wisely_wisely_1表示的則是數(shù)組的索引,它們在R文件中的表示如下:

public static final class attr { 
  public static final int wisely_1 = 0x7f010000; 
 
  public static final int wisely_2 = 0x7f010001; 
 
  public static final int wisely_3 = 0x7f010002; 
 
  public static final int wisely_4 = 0x7f010003; 
 
  public static final int wisely_out = 0x7f010004; 
 
} 
 
public static final class styleable { 
  public static final int[] Wisely = { 0x7f010000, 0x7f010001, 
      0x7f010002, 0x7f010003 }; 
 
  public static final int Wisely_wisely_1 = 0; 
 
  public static final int Wisely_wisely_2 = 1; 
 
  public static final int Wisely_wisely_3 = 2; 
 
  public static final int Wisely_wisely_4 = 3; 
} 

從上面可以看出一點(diǎn),wisely_out也是attrs.xml中的屬性,不過它是寫在以Wisely命名的標(biāo)簽之外的,所以并未列入到styleable類的Wisely數(shù)組中。

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論

梁河县| 宁夏| 深泽县| 时尚| 深泽县| 汶上县| 扎赉特旗| 大石桥市| 仲巴县| 钟祥市| 井冈山市| 辰溪县| 汶上县| 邯郸县| 万安县| 武清区| 英吉沙县| 静安区| 安仁县| 丰原市| 余姚市| 岱山县| 乌恰县| 城步| 绥滨县| 湾仔区| 海淀区| 吴桥县| 八宿县| 体育| 东乡族自治县| 莱芜市| 韶山市| 洪湖市| 奉节县| 定南县| 台南市| 孝昌县| 抚顺县| SHOW| 桐梓县|