有道词典的查询
来源:互联网 发布:淘宝里什么是历史宝贝 编辑:程序博客网 时间:2024/05/02 07:51
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
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" >
<EditText
android:id="@+id/edt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/btn"
android:layout_alignBottom="@+id/btn"
android:layout_alignParentLeft="true"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:onClick="findWord"
android:layout_marginTop="58dp"
android:text="查询" />
<WebView android:id="@+id/wvSearchResult"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@+id/edt"
android:layout_below="@+id/edt"
android:layout_marginTop="22dp"
android:textSize="25sp"
>
</WebView>
</RelativeLayout>
package com.example.youdao;
import org.w3c.dom.Text;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity {
private Button myButton01;
private EditText mEditText;
private WebView mWebView1;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
private void initView() {
// TODO Auto-generated method stub
myButton01=(Button) findViewById(R.id.btn);
mEditText=(EditText) findViewById(R.id.edt);
mWebView1=(WebView)findViewById(R.id.wvSearchResult);
}
public void findWord(View view) {
String strText=(mEditText.getText().toString()).trim(); //除去字符串开头和末尾的空格或其他字符
if (strText.length()==0) { //判断查找单词是否为空
Toast.makeText(MainActivity.this, "查询内容不能为空!", Toast.LENGTH_LONG).show();
}
else{
String strURL="http://dict.youdao.com/m/search?keyfrom=dict.mindex&q="+strText;//加载路径
mWebView1.loadUrl(strURL) ;//监听webview的通知,加载到WebView控件上显示
mWebView1.setWebViewClient(new WebViewClient() { //禁止调用系统浏览器
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return false;
}
});
}
}
}
- 有道词典的查询
- 有道词典的查询
- Python实现的命令行查询有道词典
- 调用有道词典查询
- 调用有道词典查询单词
- 有道词典查询调用网页
- 模拟有道词典在线查询
- Linux命令行有道词典查询
- 有道词典的问题
- 简单的有道词典
- 有道词典的使用
- LInux下的有道词典
- 有道词典的简单实现
- 有道词典的简单实现
- 有道词典
- 有道词典
- 有道词典
- 有道词典
- 第二题
- 第一题
- 写个博客吧
- 3
- 第二题
- 有道词典的查询
- 表关系:一对一的两种方式
- 读取文件或超大文件的几种方式
- linux sun/awt/X11GraphicsEnvironment
- 第三题
- MVC框架简述
- 6
- 再论 new 对象 时 jvm 的工作步骤
- Unable to load configuration. - bean - jar:file:/E:/tomcat/lib/struts...