久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Android窗口小部件基礎編寫代碼實例

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

實現窗口小部件,訪問手機儲存卡指定目錄中的圖片文件,然后隨機選擇一張在窗口的小部件中顯示。圖片路徑使用List存儲,適合初級Android學習者參考。本系統無服務,不能保證進程長存。

新建一個空的布局項目,然后新建一個Widget,如圖所示:

在新建的xml和java實現類中進行編寫即可。

Android窗口小部件基礎編寫代碼實例

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.baoyu77737.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>

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Android
相關文章:
主站蜘蛛池模板: 东乌珠穆沁旗| 木兰县| 沁阳市| 东丰县| 信阳市| 台湾省| 麟游县| 大新县| 依兰县| 秦安县| 临邑县| 双辽市| 饶平县| 湘潭县| 阜新| 招远市| 桐梓县| 万安县| 米泉市| 平顶山市| 长岭县| 通江县| 健康| 北京市| 东港市| 逊克县| 漳浦县| 县级市| 健康| 云龙县| 思茅市| 定西市| 石渠县| 泊头市| 贵德县| 民县| 疏附县| 怀集县| 北安市| 云浮市| 且末县|