城湟影评博客

您现在的位置是:首页 > 生活资讯 > 正文

生活资讯

安卓天气预报源代码(基于android的天气预报app开发)

影评小编2022-10-27生活资讯83

android怎样使shǐ用天bàojiē口 实现天bào

使shǐ用搜索引擎可hěnduōdebàojiē口,这里某个api为例

参数为city=城市名称

尝试获取南昌debào

南昌

到下miànxml数据

?xml version="1.0" encoding="utf-8"?

resp

  city南昌/city

  updatetime16:55/updatetime

  wendu5/wendu

  fengli3级/fengli

  shidu90%/shidu

  fengxiang北风/fengxiang

  sunrise_106:54/sunrise_1

  sunset_117:19/sunset_1

  sunrise_2/

  sunset_2/

  environment

    aqi26/aqi

    pm2513/pm25

    suggest各类人群可自由活动/suggest

    quality优/quality

    MajorPollutants/

    o344/o3

    co1/co

    pm1014/pm10

    so24/so2

    no227/no2

    time16:00:00/time

  /environment

  yesterday

    date_14星期五/date_1

    high_1高温 11℃/high_1

    low_1温 7℃/low_1

    day_1

      type_1yīn/type_1

      fx_1持续风向/fx_1

      fl_1wēi风/fl_1

    /day_1

    night_1

      type_1小到zhōng/type_1

      fx_1北风/fx_1

      fl_13-4级/fl_1

    /night_1

  /yesterday

  forecast

    weather

      date5星期六/date

      high高温 7℃/high

      low温 5℃/low

      day

        typezhōng到大/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /day

      night

        type小到zhōng/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /night

    /weather

    weather

      date6星期天/date

      high高温 10℃/high

      low温 5℃/low

      day

        typeyīn/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /day

      night

        typeduō云/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /night

    /weather

    weather

      date7星期一/date

      high高温 13℃/high

      low温 6℃/low

      day

        typeduō云/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /day

      night

        type晴/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /night

    /weather

    weather

      date8星期二/date

      high高温 13℃/high

      low温 7℃/low

      day

        type晴/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /day

      night

        typeduō云/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /night

    /weather

    weather

      date9星期三/date

      high高温 13℃/high

      low温 10℃/low

      day

        type小/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /day

      night

        type小/type

        fengxiang持续风向/fengxiang

        fengliwēi风级/fengli

      /night

    /weather

  /forecast

  zhishus

    zhishu

      name晨练指数/name

      value不/value

      detail有较强降shuǐ,请免户外晨练,建议zài室内做shì当锻liàn,保持身体健康。/detail

    /zhishu

    zhishu

      name舒shì/name

      value较舒shì/value

      detail白天有,人们会感到有些凉,但大部分人完全可jiē受。/detail

    /zhishu

    zhishu

      name穿衣指数/name

      value较lěng/value

      detail建议着厚外套jiā毛衣等服装。nián老体弱者着大衣、呢外套jiā羊毛衫。/detail

    /zhishu

    zhishu

      name感冒指数/name

      value极发/value

      detailjiāng有一次强降温过程,天lěng,且空湿较大,极发生感冒,请特别注jiā衣服保暖防寒。/detail

    /zhishu

    zhishu

      name晾晒指数/name

      value不/value

      detail有较强降shuǐ,不shì晾晒。ruòyào晾晒,请zài室内准备chū充足de空间。/detail

    /zhishu

    zhishu

      name旅游指数/name

      value较不/value

      detail天稍凉,有wēi风,同时有有较强降shuǐ,会给chū行产生hěnduō烦,建议好还是duō选择zài室内活动!。/detail

    /zhishu

    zhishu

      name紫外线强/name

      valuezuì弱/value

      detail属弱紫外线辐射天特别防护。ruò长期zài户外,建议涂擦SPFzài8-12之间de防晒护肤品。/detail

    /zhishu

    zhishu

      name洗车指数/name

      value不/value

      detail不洗车,未来24小时内有,如果zài此期间洗车,shuǐshàngdeshuǐ可能会再次弄脏您de爱车。/detail

    /zhishu

    zhishu

      name运动指数/name

      value较不/value

      detail有较强降shuǐ,建议您选择zài室内进行健身休闲运动。/detail

    /zhishu

    zhishu

      name约会指数/name

      value不shì/value

      detail较强降shuǐ会给室外约会增添许duō烦,尽量不yàochū约会,zuìzài室内促膝谈心。/detail

    /zhishu

    zhishu

      name伞指数/name

      value带伞/value

      detail有较强降shuǐ,您zàichūde时候一定yào伞,免被shuǐ淋湿。/detail

    /zhishu

  /zhishus

/resp

到数据hòu使shǐ用XML解析数据即可,zuì好是建立一个实体类来存储数据

miàn使shǐ用DOM方式解析部分数据代

DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

//is是网络连jiēde

Document doc = builder.parse(is);

if(doc==null) throw new Exception();

Element element = doc.getDocumentElement();

NodeList childList = element.getChildNodes();

for(int i=0; ichildList.getLength(); i++){

Element e = (Element) childList.item(i);

String tag = e.getTagName();

String text = e.getTextContent();

if("city".equals(tag)){

                //城市

}else if("updatetime".equals(tag)){

//更新时间

}else if("wendu".equals(tag)){

//即时温

}else if("fengli".equals(tag)){

//风力

}else if("shidu".equals(tag)){

//湿

}else if("fengxiang".equals(tag)){

//风向

}

}

求内网网页天bàoyuán!

使shǐ用方法:

1.点QQ空间里de自定义==》个人设置==》新建模块.

2.把代复制进pínglán(去掉zhǐlánlánde http://字样)

3.提交.(ok了)

bào:

iframe name="I1" src="" width="250" height="240"

/iframe

****************************************************************************************

Flash代:(FLASHzhǐyào.swf结尾)

/textareaembed src=’’http://你deFlashzhǐ’’quality=high pluginspage=’’ ... sion=shockwaveflash’’ type=’’application/x-shockwave-flash’’ width=330 height=240/embed

透明FLASH:

/textareaembed src=http://你deFlash特效zhǐ wmode=transparent style="position: absolute" width=380 height=270

注:width=height=hòumiànde数字是填FLASH大小高矮..

****************************************************************************************

bèi景音:

/textareaembed src=http://你debèi景音zhǐ width=0 height=0 loop= true (此代xiǎn播放器)

/textareaembed src=http://你debèi景音zhǐ width=2 height=2 loop= true (此代xiǎn播放器)

1.如何到音zhǐ...

首先打开百搜索

名..格式(只能是MP3WMA)→查找

找到曲..点试tīng..

:yàotīngde..而且tīng起来不卡de....!!!!(重yào)

tīng里边有个播放器..播放器右shàng方有个zhǐ..

右键点击zhǐ...→复制快捷方式

盒..点添jiā

zhǐ复制到这里..

jiāhòuyàozàihòude绿色jiāshàng打勾才能自动播放..!(重yào)

****************************************************************************************

视频MTV代:(zhǐyào.rm/.wmv/.asf/.avi/.mpg结尾)

(播放器de大小可自己diào整代zhōngde数值,只改height =“高”,width =“宽”)

.wmv或者.asf结尾:

/textareaembed src=http://你de视频文jiànzhǐ width=360 height=280 loop= true

.rm结尾:

/textareaembed src=http://你de视频文jiànzhǐ type=audio/x-pn-realaudio-plugin console=clip1 controls=ImageWindow height=124 width=180 autostart=true loop=true

.avi或者.mpg结尾:

/textareaembed src="音yuánzhǐ" border="0" width="320" height="240" type="application/x-mplayer2"/embed

小技qiǎo,想yào当你deyǒu一登陆你de空间就能马shàngtīngzuìdetīng吗? 技qiǎozài于代结尾jiāshàngwid, 如下

/textareaembed src=http://你dezhǐ width=360 height=280 wid

****************************************************************************************

电台代:(zhǐyào.asp结尾dezhǐ)

/textareaembed src= http://你de电台zhǐ type=audio/x-pn-realaudio-plugin console=clip1 controls=ImageWindow height=124 width=180 autostart=true loop=truebr

相关作用

bjiā粗/b

使shǐ文字jiā

i斜体/i

使shǐ文字qīng

ujiā下划线/u

给文字jiā下划线

sjiā删除线/s

给文字jiā删除线

pre预设格式

令文jiàn按照原始de排版方式xiǎn

*好用,省去了频繁插br与pde烦恼

****************************************************************************************

艺术字代:

发光文字代

/textareatable style="FILTER: glow(color=#6699FF,direction=2)"

font color=#ffffff size=2yào修改de文字/font

/table

zhōngcolor是yīnde颜色,可pèi合网页色diào改变,direction是设置yīnde,font color是原字体de颜色。

浮雕de文字

/textareatable style="FILTER: dropshadow(color=#6699FF, offx=1, offy=1, positive=1);"

font color=#ffffffyào修改de文字/font

/table

zhōngcolor是yīnde颜色,可pèi合网页色diào改变,positive是设置yīnde,offxoffy是设置deyīn文字de距离,font color是原字体de颜色。

yīnde文字

/textareatable style="FILTER: dropshadow(color=#cccccc, offx=2, offy=2, positive=2);"

font color=#6CABE7 size=2yào修改de文字/font

/table

文本框字体

/textareaTEXTAREA STYLE="font:12px;font-family:Verdana;color:#666666"输内容

注:字体(font-family)还可选用Arial,Tahoma等等;color可自行设定

tr 表格列 border="5"边框宽为5像素,bordercolor="Purple"边框颜色为紫色

td 表格lán bgcolor="Green"表格bèi景颜色为绿色

****************************************************************************************

超链jiē (请注:如果该链jiē为恶jiēdehuà,腾讯会自动屏蔽,请大家不yào乱用)

文字链jiē /textarea点击a href=’’http://你yàojiēdezhǐ’’ target=’’_blank’’文字说明/a

片链jiē /textareaa href="你yàojiēdezhǐ" title="文字说明",_blank

****************************************************************************************

设为首页/jiācáng:

a target=_top href=javascript:window.external.AddFavorite(''';')〖jiācáng〗/a..a href=# onClick="this.style.behavior=''url(#default#homepage)'';this.setHomePage(''';');"【设为首页】/a

****************************************************************************************

zài主页jiā钟表de:

embed src=''时钟dejiēzhǐ''quality=high pluginspage=''';' type=''application/x-shockwave-flash'' width=100(宽) height=100(高)/embed

zhōng高是 FLASHxiǎnchūde

shàngzài新建版快depínglánzhōngzhǐjiēzhǐ清空,什么都不yào留!

一直到

........................./Clock129.swf

****************************************************************************************

shàng下移动代:

片从下往shàng移动deyǒu情连jiē。效果可zài我主页看到

新建立一个模块,然hòujiāngmiàndejiāpíngzhōng

你只yào修改代zhōngzhōng文部分,连jiēzhǐ=你朋yǒudezhǐ

zhǐ=你朋yǒudeLOGOzhǐ

marquee behavior="scroll" direction=up width="120" height="60" scrollamount="1" scrolldelay="60" onmouseover="this.stop()" onmouseout="this.start()"a target="cont" href="连jiēzhǐ"img src="http://zhǐ" width="88" height="33" border="0"/a/marquee

这是一个移动de,如果你yàoduōdehuà就这样

marquee behavior="scroll" direction=up width="120" height="60" scrollamount="1" scrolldelay="60" onmouseover="this.stop()" onmouseout="this.start()"a target="cont" href="连jiēzhǐ"img src="http://zhǐ" width="88" height="33" border="0"/aa target="cont" href="连jiēzhǐ"img src="zhǐ" width="88" height="33" border="0"/a/marquee

对比就看chū来了,下miànduōchū

a target="cont" href="连jiēzhǐ"img src="zhǐ" width="88" height="33" border="0"/a

就这样,你每duō一个连jiē你就duō插进去一段!

****************************************************************************************

搜索条代:

iframe id="baiduframe" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="700" height="50"

src=";csid=1rkcs=0bgcr=E2EEFCftcr=003366wd=700ht=50tbsz=12sropls=1,4,6,2,3kwnm=18kwgp=1rk=1bd=1bdas=1tbst=1sropst=1"

/iframe

****************************************************************************************

滚动字:

这是代

marquee border="0" align="middle" scrolldelay="120"想说de字/marquee

****************************************************************************************

其它代:

屏蔽右键代 /textareabody oncontextmenu="return false" (这条代防止yuán被盗取,推荐使shǐ用)

网页法另存代 /textareanoscriptiframe src=*/iframe/noscript

网页透明代 /textareabody background-color:transparent

其他html代

****************************************************************************************

默林魔法老人代:

body

SCRIPT

!--

function crml(nid)

{

try

{

nid=new ActiveXObject("Agent.Control.2");

nid.Connected = true;

nid.Characters.Load("");

return nid;

}

catch (err)

{

return false;

}

}

function chplay ()

kǎo料:

求Android天bàode开发yuán

package com.nrzc.weatherstation;

import android.content.Context;

import android.hardware.Sensor;

import android.hardware.SensorEvent;

import android.hardware.SensorEventListener;

import android.hardware.SensorManager;

import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;

import android.widget.TextView;

import java.util.Timer;

import java.util.TimerTask;

/**

* 环jìng传感器

* 象站

*/

public class MainActivity extends AppCompatActivity {

private SensorManager sensorManager;

private TextView temperatureTextView;

private TextView pressureTextView;

private TextView lightTextView;

private float currentTemperature=Float.NaN;

private float currentPressure=Float.NaN;

private float currentLight=Float.NaN;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

init();

Timer updateTimer=new Timer("weatherUpdate");

updateTimer.scheduleAtFixedRate(new TimerTask() {

@Override

public void run() {

updateGUI();

}

},0,1000);

}

private void init(){

temperatureTextView=(TextView)findViewById(R.id.temperature);

pressureTextView=(TextView)findViewById(R.id.pressure);

lightTextView=(TextView)findViewById(R.id.light);

sensorManager=(SensorManager)getSystemService(Context.SENSOR_SERVICE);

}

private final SensorEventListener tempSensorEventListener=new SensorEventListener() {

@Override

public void onSensorChanged(SensorEvent event) {

currentTemperature=event.values[0];

}

@Override

public void onAccuracyChanged(Sensor sensor, int accuracy) {

}

};

private final SensorEventListener pressureSensorEventListener=new SensorEventListener() {

@Override

public void onSensorChanged(SensorEvent event) {

currentPressure=event.values[0];

}

@Override

public void onAccuracyChanged(Sensor sensor, int accuracy) {

}

};

private final SensorEventListener lightSensorEventListener=new SensorEventListener() {

@Override

public void onSensorChanged(SensorEvent event) {

currentLight=event.values[0];

}

@Override

public void onAccuracyChanged(Sensor sensor, int accuracy) {

}

};

@Override

protected void onResume() {

super.onResume();

Sensor lightSensor=sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);

if (lightSensor!=null)

sensorManager.registerListener(lightSensorEventListener,

lightSensor,

SensorManager.SENSOR_DELAY_NORMAL);

else

lightTextView.setText("Light Sensor Unavailable");

Sensor pressureSensor=sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);

if (pressureSensor!=null)

sensorManager.registerListener(pressureSensorEventListener,

pressureSensor,SensorManager.SENSOR_DELAY_NORMAL);

else

pressureTextView.setText("Barometer Unavailable");

Sensor temperatureSensor=sensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);

if (temperatureSensor!=null)

sensorManager.registerListener(tempSensorEventListener,

temperatureSensor,

SensorManager.SENSOR_DELAY_NORMAL);

else

temperatureTextView.setText("Thermometer Unavailable");

}

@Override

protected void onPause() {

sensorManager.unregisterListener(pressureSensorEventListener);

sensorManager.unregisterListener(tempSensorEventListener);

sensorManager.unregisterListener(lightSensorEventListener);

super.onPause();

}

private void updateGUI(){

runOnUiThread(new Runnable() {

@Override

public void run() {

if(!Float.isNaN(currentPressure)){

pressureTextView.setText(currentPressure+"hPa");

pressureTextView.invalidate();

}

if (!Float.isNaN(currentLight)){

String lightStr="Sunny";

if (currentLight=SensorManager.LIGHT_CLOUDY)

lightStr="night";

else if (currentLight=SensorManager.LIGHT_OVERCAST)

lightStr="Cloudy";

else if (currentLight=SensorManager.LIGHT_SUNLIGHT)

lightStr="Overcast";

lightTextView.setText(lightStr);

lightTextView.invalidate();

}

if (!Float.isNaN(currentTemperature)){

temperatureTextView.setText(currentTemperature+"C");

temperatureTextView.invalidate();

}

}

});

}

}

跪求基于安zhuō平台debào系统de设计与实现deyuán???yào没有乱de,能zàizài模拟器shàng运行de。。。。

我做de项目zhōng有从zhōngguó网获取de5数据de,你yàoyào?因为目前chù于功能设计阶段,界miàn不怎么美观,yàohòu期才会美化!你如果有基础dehuà,我可提供获取数据de,只yào自己设计个界miàn,数据放shàngxiǎn示就好。

求网站zhōngjiābàode

miàn这段是它deyuánjiàn

html

head

meta http-equiv="Content-Type" content="text/html; charset=GBK" /

title07越秀/title

link href="../css/ddg.css" rel="stylesheet" type="text/css"

/head

body style="background-color:transparent"

table width="100%" height="80" border="0" cellpadding="0" cellspacing="0"

tr

td height="15"img src="images/spacer.gif" width="1" height="8" //td

/tr

tr

td width="60" align="center" valign="top"!--5-12修改6开始--img src="" alt="" /img src="" alt="" /!--5-12修改6结束--/td

td align="left" valign="top"font id="dateFont"2007nián1月16br /

星期二 下午17:02br /

/font

script

var day = new Array("星期","星期一","星期二","星期三","星期四","星期五","星期六");

function showDate()

{

font = document.getElementById("dateFont");

var now = new Date();

var str = "";

var hours = now.getHours() + "";

if(hours.length 2)

{

hours = "0" + hours;

}

var minutes = now.getMinutes() + "";

if(minutes.length 2)

{

minutes = "0" + minutes;

}

var seconds = now.getSeconds() + "";

if(seconds.length 2)

{

seconds = "0" + seconds;

}

str += "font style=\"color:#000000;\"b" + now.getFullYear() + "nián" + (now.getMonth() + 1) + "月" + now.getDate() + "/b/fontbrfont style=\"color:#EB7002;\"" + day[now.getDay()] + " " + hours + ":" + minutes + ":" + seconds + "/fontbr";

font.innerHTML = str;

}

setInterval("showDate()" , 1000);

/script

font style="color:#EB7002;"

duō云转阵   25℃~34℃

/font/td

/tr

tr

td height="8"img src="images/spacer.gif" width="1" height="8" //td

/tr

/table

/body

/html

再给你推荐一个根据不同IPxiǎn示不同de

iframe src="" width="160" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"/iframe

都试试吧