這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)Android開發(fā)中如何實(shí)現(xiàn)一個窗口小部件,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
實(shí)現(xiàn)窗口小部件,訪問手機(jī)儲存卡指定目錄中的圖片文件,然后隨機(jī)選擇一張?jiān)诖翱诘男〔考酗@示。圖片路徑使用List存儲,適合初級Android學(xué)習(xí)者參考。本系統(tǒng)無服務(wù),不能保證進(jìn)程長存。
新建一個空的布局項(xiàng)目,然后新建一個Widget,如圖所示:
在新建的xml和java實(shí)現(xiàn)類中進(jì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>
網(wǎng)站題目:Android開發(fā)中如何實(shí)現(xiàn)一個窗口小部件-創(chuàng)新互聯(lián)
網(wǎng)頁鏈接:http://www.chinadenli.net/article6/dgehog.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、App開發(fā)、自適應(yīng)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司、域名注冊
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容