Android ViewPagerIndicator詳解及實(shí)例代碼
成都創(chuàng)新互聯(lián)成都網(wǎng)站建設(shè)按需制作,是成都網(wǎng)站建設(shè)公司,為成都三輪攪拌車(chē)提供網(wǎng)站建設(shè)服務(wù),有成熟的網(wǎng)站定制合作流程,提供網(wǎng)站定制設(shè)計(jì)服務(wù):原型圖制作、網(wǎng)站創(chuàng)意設(shè)計(jì)、前端HTML5制作、后臺(tái)程序開(kāi)發(fā)等。成都網(wǎng)站制作熱線(xiàn):028-86922220
關(guān)于自定義View的屬性零碎知識(shí)
自定義View和自定義屬性的知識(shí)不再此提及,這里著重說(shuō)的是屬性在自定義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ù)組的索引,它們?cè)赗文件中的表示如下:
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中的屬性,不過(guò)它是寫(xiě)在以Wisely命名的標(biāo)簽之外的,所以并未列入到styleable類(lèi)的Wisely數(shù)組中。
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
網(wǎng)頁(yè)標(biāo)題:AndroidViewPagerIndicator詳解及實(shí)例代碼
轉(zhuǎn)載來(lái)源:http://sd-ha.com/article4/joscie.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作、動(dòng)態(tài)網(wǎng)站、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、定制開(kāi)發(fā)、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)