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

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

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

瀏覽:3日期: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.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>

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

標簽: Android
相關文章:
主站蜘蛛池模板: 富民县| 乌海市| 那坡县| 霍山县| 宁城县| 锡林浩特市| 上饶市| 富民县| 星座| 壤塘县| 吉林市| 美姑县| 青龙| 阿合奇县| 九江市| 新闻| 遵化市| 海盐县| 时尚| 嵊州市| 白朗县| 理塘县| 彭泽县| 广汉市| 盖州市| 弥渡县| 福安市| 灌南县| 孟州市| 通渭县| 卢湾区| 荆州市| 洛南县| 离岛区| 衡水市| 航空| 蒙山县| 津市市| 都昌县| 庆阳市| 开平市|