自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

解析關(guān)于Widget配置文件學(xué)習(xí)應(yīng)用

移動(dòng)開發(fā)
Widget配置文件學(xué)習(xí)應(yīng)用是本文要介紹的內(nèi)容,主要是來(lái)了解并學(xué)習(xí)Widget配置文件,具體內(nèi)容的實(shí)現(xiàn)來(lái)看詳細(xì)代碼。

Widget配置文件學(xué)習(xí)應(yīng)用是本文要介紹的內(nèi)容,主要是來(lái)了解并學(xué)習(xí)Widget配置文件,具體內(nèi)容的實(shí)現(xiàn)來(lái)看詳細(xì)代碼。

有關(guān)AndroidManifest.xml中詳細(xì)的recevier代碼如下

  1. <receiver android:name=".ProtipWidget" android:label="@string/widget_name"> 
  2.           <intent-filter> 
  3.               <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> 
  4.               <action android:name="com.android.protips.NEXT_TIP" /> 
  5.               <action android:name="com.android.protips.HEE_HEE" /> 
  6.           </intent-filter> 
  7.          <meta-data android:name="android.appwidget.provider"   
  8. roid:resource="@xml/widget_build" /> 
  9.      </receiver>    

有關(guān)res/xml/widget_build.xml的代碼如下

  1. <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" 
  2.   android:minWidth="294dip" 
  3.   android:minHeight="72dip" 
  4.   android:updatePeriodMillis="0" 
  5.   android:initialLayout="@layout/widget" />    

有關(guān)res/layout/widget.xml的代碼如下,注意下面使用了布局文件套嵌的include方式  

  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  2.      android:id="@+id/widget" 
  3.     android:layout_width="fill_parent" 
  4.      android:layout_height="wrap_content" 
  5.      android:orientation="vertical" 
  6.      android:padding="5dip" 
  7.     > 
  8.    
  9.      <include layout="@layout/droid" /> 
  10.     <include layout="@layout/bubble" /> 
  11.  </RelativeLayout> 

有關(guān)res/layout/droid.xml的代碼如下

  1. <ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
  2.   android:id="@+id/bugdroid" 
  3.   android:src="@drawable/droidman_down_closed" 
  4.   android:scaleType="center" 
  5.   android:layout_width="wrap_content" 
  6.   android:layout_height="wrap_content" 
  7.   android:layout_alignParentRight="true" 
  8.   android:layout_centerVertical="true" 
  9.   /> 

有關(guān)res/layout/bubble.xml的代碼如下

  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  2.   android:id="@+id/tip_bubble" 
  3.   android:layout_width="fill_parent" 
  4.   android:layout_height="wrap_content" 
  5.   android:layout_toLeftOf="@+id/bugdroid" 
  6.   android:layout_centerVertical="true" 
  7.  android:gravity="center_vertical|left" 
  8.   android:layout_marginRight="2dip" 
  9.   android:visibility="invisible" 
  10.  android:background="@drawable/droid_widget" 
  11.  android:focusable="true" 
  12.  > 
  13.  <TextView 
  14.      android:layout_width="0dip" 
  15.      android:layout_height="0dip" 
  16.      android:layout_alignParentTop="true" 
  17.      android:layout_marginTop="-100dip" 
  18.      android:text="@string/widget_name" 
  19.      /> 
  20.  <TextView 
  21.      android:layout_width="0dip" 
  22.      android:layout_height="0dip" 
  23.      android:layout_alignParentTop="true" 
  24.      android:layout_marginTop="-90dip" 
  25.      android:text="@string/tts_pause" 
  26.      /> 
  27.  <TextView 
  28.      android:id="@+id/tip_footer" 
  29.      style="@style/TipText.Footer" 
  30.      android:layout_width="wrap_content" 
  31.      android:layout_height="wrap_content" 
  32.      android:layout_alignParentBottom="true" 
  33.      android:layout_alignParentRight="true" 
  34.      android:layout_marginRight="1dip" 
  35.      /> 
  36.  <ImageView 
  37.      android:id="@+id/tip_callout" 
  38.      android:layout_width="wrap_content" 
  39.      android:layout_height="fill_parent" 
  40.      android:gravity="center" 
  41.      android:layout_alignParentTop="true" 
  42.      android:layout_alignParentRight="true" 
  43.      android:layout_above="@id/tip_footer" 
  44.      android:visibility="gone" 
  45.      android:padding="4dip" 
  46.      /> 
  47.  <TextView 
  48.      android:id="@+id/tip_header" 
  49.      style="@style/TipText.Header" 
  50.      android:layout_width="fill_parent" 
  51.      android:layout_height="wrap_content" 
  52.      android:layout_alignParentTop="true" 
  53.      android:layout_toLeftOf="@id/tip_callout" 
  54.      android:layout_alignWithParentIfMissing="true" 
  55.      android:layout_marginTop="0dip" 
  56.      android:layout_marginLeft="3dip" 
  57.      /> 
  58.  <TextView 
  59.      android:id="@+id/tip_message" 
  60.      style="@style/TipText.Message" 
  61.      android:layout_width="fill_parent" 
  62.      android:layout_height="wrap_content" 
  63.      android:layout_below="@id/tip_header" 
  64.      android:layout_alignLeft="@id/tip_header" 
  65.      android:layout_alignRight="@id/tip_header" 
  66.      android:layout_marginTop="1dip" 
  67.      /> 
  68. elativeLayout> 

有關(guān)上面bubble.xml中的drawable對(duì)象droid_widget的代碼如

  1. <selector xmlns:android="http://schemas.android.com/apk/res/android"> 
  2.   <item android:state_pressed="true" android:drawable="@drawable/droid_widget_pressed" /> 
  3.   <item android:state_focused="true" android:state_window_focused="true" android:drawable="@drawable/droid_widget_focused" /> 
  4.   <item android:state_focused="true" android:state_window_focused="false" android:drawable="@drawable/droid_widget_normal" /> 
  5.   <item android:drawable="@drawable/droid_widget_normal" /> 
  6. selector> 

小結(jié):解析關(guān)于Widget配置文件學(xué)習(xí)應(yīng)用的內(nèi)容介紹完了,希望通過(guò)Widget配置文件內(nèi)容的學(xué)習(xí)能對(duì)你有所幫助!

責(zé)任編輯:zhaolei 來(lái)源: 博客園
相關(guān)推薦

2011-09-08 15:40:45

Android Wid組件

2010-03-18 18:17:01

Python 配置文件

2011-09-09 17:59:26

QT Widget

2011-03-28 09:07:26

Nagios配置文件

2011-09-09 11:05:56

Widget

2011-09-09 19:23:52

Widget

2010-02-22 10:18:18

WCF配置文件

2021-07-05 12:09:58

Python編程語(yǔ)言

2022-11-10 09:05:18

Lua配置文件

2011-09-07 13:42:36

Android Wid實(shí)例

2010-05-23 10:11:01

Widget開發(fā)

2009-11-17 16:46:01

PHP配置文件

2021-07-13 05:47:40

GroovyJSON軟件開發(fā)

2011-09-07 16:28:46

QT WidgetQWidget

2011-09-07 16:36:00

Qt Widget

2009-12-21 11:19:50

WCF配置文件

2011-09-07 14:25:53

Android Wid設(shè)計(jì)

2010-02-03 09:19:31

Python模塊

2009-11-27 08:59:29

VS2003配置文件

2021-08-13 13:55:03

鴻蒙HarmonyOS應(yīng)用
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)