亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

實(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)類(lèi)中進(jìn)行編寫(xiě)即可。

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>

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

相關(guān)文章

最新評(píng)論