国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Android窗口小部件基礎(chǔ)編寫(xiě)代碼實(shí)例

瀏覽:6日期:2022-09-21 17:15:02

實(shí)現(xiàn)窗口小部件,訪問(wèn)手機(jī)儲(chǔ)存卡指定目錄中的圖片文件,然后隨機(jī)選擇一張?jiān)诖翱诘男〔考酗@示。圖片路徑使用List存儲(chǔ),適合初級(jí)Android學(xué)習(xí)者參考。本系統(tǒng)無(wú)服務(wù),不能保證進(jìn)程長(zhǎng)存。

新建一個(gè)空的布局項(xiàng)目,然后新建一個(gè)Widget,如圖所示:

在新建的xml和java實(shí)現(xiàn)類中進(jìn)行編寫(xiě)即可。

Android窗口小部件基礎(chǔ)編寫(xiě)代碼實(shí)例

picture_widget.xml文件如下:

<RelativeLayout xmlns:android='http://schemas.android.com/apk/res/android' android:layout_width='match_parent' android:layout_height='match_parent' android:padding='@dimen/widget_margin'> <ImageView android: android:layout_width='match_parent' android:layout_height='match_parent' android:src='http://www.intensediesel.com/bcjs/@drawable/zhizhuxia' /> <TextView android: android:layout_width='wrap_content' android:layout_height='wrap_content' android:text='' android:textSize='10dp' android:gravity='right|bottom' android:layout_marginRight='2dp' android:layout_marginBottom='2dp'/></RelativeLayout>

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

標(biāo)簽: Android
相關(guān)文章:
主站蜘蛛池模板: 彰武县| 枣阳市| 商都县| 内黄县| 英山县| 富蕴县| 惠安县| 汕头市| 车险| 绥化市| 额济纳旗| 淮滨县| 长葛市| 和田市| 铜梁县| 延寿县| 南涧| 天长市| 遵义市| 大余县| 建阳市| 淅川县| 舞阳县| 宿松县| 安阳市| 新乡县| 涟源市| 泾源县| 阿合奇县| 淮北市| 池州市| 吉木乃县| 廉江市| 新绛县| 收藏| 西乌珠穆沁旗| 兰西县| 钦州市| 香港| 将乐县| 双桥区|