主题文章

> 教程

[制作教程] MAML 之【内容提供 ContentProviderBinder】

发布时间: 2015-06-01 14:36

<ContentProviderBinder />

定义一个ContentProvider和绑定到它上的变量




<Variable />定义一个绑定变量


规范代码:

<!--name2查询结束后会触发name1的查询,name1的查询可以使用name2的变量。如果name2数据发生变化重新查询后,会触发name1的重新查询 -->
<ContentProviderBinder name="name1" dependency="name2">
<ContentProviderBinder name="name2" >


<VariableBinders>
ContentProviderBinder
name="weather_provider"
uri="content://weather/weather"
columns="city_id,city_name,weather_type,aqilevel,temperature,tmphighs,tmplows"
<countName="hasweather" denpendency="selected_city">
<Variable name="weather_location_id" type="string" column="city_id"/>
<Variable name="weather_location" type="string" column="city_name"/>
<Variable name="weather_id" type="int" column="weather_type"/>
<Variable name="weather_aqilevel" type="int" column="aqilevel"/>
<Variable name="weather_temperature" type="int" column="temperature"/>
<Variable name="weather_temphigh" type="int" column="tmphighs"/>
<Variable name="weather_templow" type="int" column="tmplows"/>
<Variable name="weather_id1" type="int" column="weather_type" row="1"/>
<Variable name="weather_temphigh1" type="int" column="tmphighs" row="1"/>
<Variable name="weather_templow1" type="int" column="tmplows" row="1"/>
<Variable name="weather_id2" type="int" column="weather_type" row="2"/>
<Variable name="weather_temphigh2" type="int" column="tmphighs" row="2"/>
<Variable name="weather_templow2" type="int" column="tmplows" row="2"/>
<Variable name="weather_id3" type="int" column="weather_type" row="3"/>
<Variable name="weather_temphigh3" type="int" column="tmphighs" row="3"/>
<Variable name="weather_templow3" type="int" column="tmplows" row="3"/>
</ContentProviderBinder>
ContentProviderBinder
uri="content://weather/selected_city"
columns="flag"
whereFormat="posID='%s'" whereParas="@weather_location_id"
<dependency="weather_provider">
<Variable name="is_location_city" type="int" column="flag"/>
</ContentProviderBinder>
</VariableBinders>

亲,你需要登录后才能对该作品进行评论喔!

登录 立即注册