高端响应式模板免费下载

响应式网页设计、开放源代码、永久使用、不限域名、不限使用次数

什么是响应式网页设计?

如何制作网站机器人(精选)3篇

2024年如何制作网站机器人 篇1

1,首先自己下载工具,搭建一个Android开发环境,去百度一下(安卓开发环境搭建),有详细步骤。

2,百度搜索“图灵机器人”,去注册一个账号,获取api key,用来调用图灵机器人的数据。2

把API key 复制下来放在一个记事本,之后要在代码中用的。3

先新建一个Android工程,我的工程名为:Person,源代码在com.shenbin.person包下,MainActivity是Android的activity。

还包括HttpDate类,HttpGetDateListener类,ListDate类,TextAdapter类

//MainActivity代码:

/*下面的代码修改

httpDate = (HttpDate) new HttpDate("http://www.tuling123.com/openapi/api?key=********&info=" +droph,this).execute();

把********替换成自己的API key

*/

package com.shenbin.person;

import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.List;

import org.json.JSONException;import org.json.JSONObject;

import android.os.Bundle;import android.app.Activity;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.EditText;import android.widget.ListView;

public class MainActivity extends Activity implements HttpGetDateListener,OnClickListener{ //实现接口

private HttpDate httpDate; private List<ListDate> lists; private ListView lv; private EditText getText; private Button send_btn; private String content_str; private TextAdapter adapter; private String [] welcome_array; private double currentTime,oldTime = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); //httpDate = (HttpDate) new HttpDate("http://www.tuling123.com/openapi/api?key=5692c0d167fc5a180d092efaab578617&info=你好", //this).execute(); }

private void initView() { lv = (ListView) findViewById(R.id.lv); getText = (EditText) findViewById(R.id.sendText); send_btn = (Button) findViewById(R.id.send_btn); //send_btn.setOnClickListener((android.view.View.OnClickListener) this); send_btn.setOnClickListener(this); lists = new ArrayList<ListDate>(); adapter = new TextAdapter(lists, this); lv.setAdapter(adapter); ListDate listDate = null ; listDate = new ListDate(getRandomWelcomeTips(),listDate.RECEIVER,getTime()); lists.add(listDate);

} private String getRandomWelcomeTips() { String welcome_tip = null; welcome_array = this.getResources().getStringArray(R.array.welcome_tips); //获得string。xml的欢迎语 int index = (int) (Math.random()*(welcome_array.length-1)); welcome_tip = welcome_array[index]; return welcome_tip; } @Override public void getDateUrl(String date) { // TODO 自动生成的方法存根 //System.out.println(date); parseText(date); } public void parseText(String str) { try { JSONObject jb = new JSONObject(str); //System.out.println(jb.getString("code")); //System.out.println(jb.getString("text")); ListDate listDate = null; listDate = new ListDate(jb.getString("text"),listDate.RECEIVER,getTime()); lists.add(listDate); adapter.notifyDataSetChanged(); } catch (JSONException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } }

@Override public void onClick(View v) { getTime(); content_str = getText.getText().toString(); getText.setText(""); String dropk = content_str.replace(" ", ""); String droph = dropk.replace("\n", ""); ListDate listDate; listDate = new ListDate(content_str,ListDate.SEND,getTime()); lists.add(listDate); //如果太多了,就移除一些 if (lists.size() > 30) { for (int i = 0; i < lists.size(); i++) { lists.remove(i); } } adapter.notifyDataSetChanged(); httpDate = (HttpDate) new HttpDate("http://www.tuling123.com/openapi/api?key=********&info=" +droph,this).execute();

} private String getTime() { currentTime = System.currentTimeMillis(); SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); Date curDate = new Date(); String str = format.format(curDate); if (currentTime - oldTime > 5*60*1000) { oldTime = currentTime; return str; }else { return ""; } }

}

//HttpDate类代码

package com.shenbin.person;

import java.io.BufferedReader;import java.io.InputStream;import java.io.InputStreamReader;

import org.apache.http.HttpEntity;import org.apache.http.HttpResponse;import org.apache.http.client.HttpClient;import org.apache.http.client.methods.HttpGet;import org.apache.http.impl.client.DefaultHttpClient;import android.os.AsyncTask;

public class HttpDate extends AsyncTask<String, Void, String>{ private HttpClient mHttpClient; //客户端 private HttpGet mHttpGet; //请求方式为get private String url; //请求的地址 private HttpResponse mHttpResponse; //请求返还 private HttpEntity mHttpEntity; //创建实体 private InputStream in; private HttpGetDateListener listener; //获得接口

public HttpDate(String url,HttpGetDateListener listener) { this.url = url; this.listener = listener; } @Override protected String doInBackground(String... arg0) { // TODO 自动生成的方法存根 try { mHttpClient = new DefaultHttpClient(); //实例化客户端 mHttpGet = new HttpGet(url); mHttpResponse = mHttpClient.execute(mHttpGet); mHttpEntity = mHttpResponse.getEntity(); in = mHttpEntity.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line = null; //获取数据 StringBuffer sb = new StringBuffer(); while (( line = br.readLine()) != null) { sb.append(line); } return sb.toString(); } catch (Exception e) { // TODO: handle exception } return null; } @Override protected void onPostExecute(String result) { // TODO 自动生成的方法存根 listener.getDateUrl(result); super.onPostExecute(result); }

}

//HttpGetDateListener类代码

//接口

package com.shenbin.person;

public interface HttpGetDateListener {

void getDateUrl(String date);}

//ListDate类代码

package com.shenbin.person;

import android.R.integer;

public class ListDate { private String content; public static final int SEND = 1; public static final int RECEIVER = 2; private int flag; private String time; public ListDate(String content,int flag,String time) { // TODO 自动生成的构造函数存根 setContent(content); setFlag(flag); setTime(time); } public void setContent(String content) { this.content = content; }

public String getContent() { return content; }

public int getFlag() { return flag; }

public void setFlag(int flag) { this.flag = flag; }

public String getTime() { return time; }

public void setTime(String time) { this.time = time; }

}

//TextAdapter类代码

package com.shenbin.person;

import java.net.ContentHandler;import java.util.List;

import javax.security.auth.PrivateCredentialPermission;

import android.R.layout;import android.content.Context;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.webkit.WebView.FindListener;import android.widget.BaseAdapter;import android.widget.RelativeLayout;import android.widget.TextView;

public class TextAdapter extends BaseAdapter{ private List<ListDate> lists; private Context nContext; private RelativeLayout layout; public TextAdapter(List<ListDate> lists,Context nContext) { this.lists = lists; this.nContext = nContext; }

@Override public int getCount() { // TODO 自动生成的方法存根 return lists.size(); }

@Override public Object getItem(int pesition) { return lists.get(pesition); }

@Override public long getItemId(int pesition) { // TODO 自动生成的方法存根 return pesition; }

@Override public View getView(int pesition, View converView , ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(nContext); if (lists.get(pesition).getFlag() == ListDate.RECEIVER) { layout = (RelativeLayout) inflater.inflate(R.layout.leftitem, null); } if (lists.get(pesition).getFlag() == ListDate.SEND) { layout = (RelativeLayout) inflater.inflate(R.layout.rightitem, null); } TextView tv = (TextView) layout.findViewById(R.id.tv); tv.setText(lists.get(pesition).getContent()); TextView time = (TextView) layout.findViewById(R.id.time); time.setText(lists.get(pesition).getTime()); return layout; }

}

activity_main.xml的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" >

<ListView android:id="@+id/lv" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:divider="@null" android:listSelector="@android:color/transparent" android:transcriptMode="alwaysScroll" ></ListView> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <EditText android:id="@+id/sendText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> <Button android:id="@+id/send_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send" /> </LinearLayout>

</LinearLayout>

leftitem.xml代码

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/time" android:layout_width="fill_parent" android:gravity="center_horizontal" android:layout_height="wrap_content" /> <ImageView android:layout_below="@id/time" android:id="@+id/iv" android:layout_width="70dp" android:layout_height="70dp" android:padding="10dp" android:src="@drawable/c" /> <TextView android:layout_below="@id/time" android:layout_toRightOf="@id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv" android:gravity="center" android:background="@drawable/d" />

</RelativeLayout>

rightitem.xml代码

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/time" android:layout_width="fill_parent" android:gravity="center_horizontal" android:layout_height="wrap_content" /> <ImageView android:layout_below="@id/time" android:layout_alignParentRight="true" android:id="@+id/iv" android:layout_width="70dp" android:layout_height="70dp" android:padding="10dp" android:src="@drawable/b" /> <TextView android:layout_below="@id/time" android:layout_toLeftOf="@id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv" android:gravity="center" android:background="@drawable/d" />

</RelativeLayout>

values文件下的strings.xml代码

<?xml version="1.0" encoding="utf-8"?><resources>

<string name="app_name">小兵机器人</string> <string name="action_settings">Settings</string> <string name="hello_world">小兵聊天机器人</string> <string name="send">发送</string> <string-array name="welcome_tips"> <item>主人,奴婢在此等候多时了</item> <item>主人,近来可好</item> <item>欢迎归来,我亲爱的主人</item> <item>主人,我好想你啊</item> <item>主人,你越来越靓啦</item> <item>我是小兵机器人,很高兴陪你聊天</item> <item>我就是聪明,可爱的小兵机器人</item> <item>hello,美女(帅锅)</item> <item>你是我的小呀小苹果</item> <item>开心的话,可以找我聊天,不开心更要找我聊天啦</item> </string-array>

</resources>

AndroidManifest.xml的代码

添加的代码为加黑的粗体。

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.shenbin.person" android:versionCode="1" android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET"/>

<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.shenbin.person.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>

2024年如何制作网站机器人 篇2

首先肯定要经常去四大家族的首页浏览一番了:

ABB http://new.abb.com/

KUKA https://www.kuka.com/zh-cn#

FANUC http://www.fanuc.com/

YASKAWA https://www.yaskawa-global.com/

在四大家族的主页上可以浏览各工厂所有的机器人机型及使用手册,还有公司的发展情况以及最新的新闻,是了解工业机器人最新内容的渠道之一。

Assembly https://www.assemblymag.com/ 可以在上面找到机器人装配的新闻与知识,涉及面很广,从航天汽车医疗的组装到粘合器运动控制焊接。

CIOReview https://www.cioreview.com/从CIO的演讲采访中获取相关知识。

ROBO community http://www.robocommunity.com/ 一个论坛,既可以在上面问机器人的使用问题也可以问机器人的编码问题,总之,自由讨论。

Society of Robots http://www.societyofrobots.com/ 既适合初学者也适合专业人士,内容涉及机器人书籍、零件等等,网页论坛的活跃度比较高。

Instructables http://www.instructables.com/ 一个集合了各路江湖好手制作的五花八门的机器人的网站,并且都附上了制作过程,值得一看。比如这是网站举办的机器人制作大赛得了第一名的作品——智能感知机器人(地震房屋警报/位置和深度跟踪器)。

LRIG http://news.lrig.org/#/ 一个汇集了来自世界各地的实验室自动化的新闻网站。

MARKETSANDMARKETS https://www.marketsandmarkets.com/ 在这个网站上,你可以找到自己想要的行业信息与市场分析。

接下来是几个国外知名大学的机器人研究实验室:

布朗大学 https://hcri.brown.edu/ 布朗大学有一个以人性为中心的机器人行动(HCRI),在这个网站上你可以看到HCRI的活动会谈的所有视频。

剑桥大学 http://svr-www.eng.cam.ac.uk/

牛津大学 http://www.robots.ox.ac.uk/~parg/application_domains 可以在该网站上找到权威文献与正在进行的相关项目。

斯坦福大学 http://ai.stanford.edu/

斯坦福大学人工智能实验室 http://cs.stanford.edu/groups/manips/teaching.html 网站有机器人介绍、实验机器人和高级机器人三类课程,你可以在这个网站上观看课程讲义和进行仿真的学习。

2024年如何制作网站机器人 篇3

QQ 机器人是一种对QQ进行功能扩展的程序,在机器人服务端登录QQ号码后可以按照预先设定的一些指令自动完成某些任务,例如与好友进行交谈,如腾讯的叨客机器人,也可以执行一些数据交互任务,如滔滔和得瑟的机器人,就是将好友发来的消息推送的网站,实现qq与网站的交互。

大部分非腾讯官方的机器人都是采用lumaqq等开源qq协议进行编写。目前还没有开源的qq机器人,部分网站提供webservice。

QQ机器人其实就是把常用的数据录入到数据库中,当你提交不同的数据就会自动从数据库中调用不同的数据反馈给你,完全就是一个搜索查找功能,和百度的搜索没有什么两样,完全是一问一答,有的时候还是答非所问。数据中的数据还有待大量的搜集和完善。QQ机器人的发展前景是非常广阔的。

猜你喜欢