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

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

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

瀏覽:6日期: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
相關文章:
主站蜘蛛池模板: 昭平县| 青岛市| 涟水县| 天祝| 永靖县| 方正县| 微山县| 田东县| 郸城县| 分宜县| 大兴区| 哈巴河县| 民勤县| 江陵县| 洛川县| 赤峰市| 紫金县| 黑水县| 永泰县| 五华县| 浦北县| 民县| 祁门县| 轮台县| 伊金霍洛旗| 祁阳县| 房山区| 高唐县| 嘉义县| 安吉县| 抚宁县| 仙游县| 邵阳县| 南宁市| 青铜峡市| 榆中县| 万山特区| 永胜县| 漳浦县| 库伦旗| 金门县|