欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2020年11月17日 10:48:29   投稿:yaominghui  
這篇文章主要介紹了Android窗口小部件基礎(chǔ)編寫代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下

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

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

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

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:id="@+id/picture_widget"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/zhizhuxia" />
  <TextView
    android:id="@+id/change_picture"
    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>

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論