登录
首页 » Android » Android myWebView实现单词翻译-口袋词典

Android myWebView实现单词翻译-口袋词典

于 2023-05-02 发布 文件大小:74.03 kB
0 371
下载积分: 2 下载次数: 1

代码说明:

Android 写的一个翻译小程序,应该说是一个网络编程的初级范例,使用myWebView实现单词翻译-口袋词典,运行界面效果请参见截图,相关代码:   EditText myEditText;//用于接收用户输入   WebView myWebView;//WebView,用户显示html    @Override    public void onCreate(Bundle savedInstanceState) {//重写的onCreate方法    super.onCreate(savedInstanceState);    setContentView(R.layout.main);//设置当前的用户界面    myEditText = (EditText) findViewById(R.id.myEditText);//得到EditText的引用    myWebView = (WebView) findViewById(R.id.myWebView);//得到WebView的引用    WebSettings myWebSettings = myWebView.getSettings();//取得WebSettings    myWebSettings.setJavaScriptEnabled(true);//设置可以运行JavaScript    myWebView.addJavascriptInterface(this, "ytl");//设置给html调用的对象及名称    String url = "file:///android_asset/translate.html";    myWebView.loadUrl(url);//将assets/translate.html载入    }   public void runJavaScript(){//自定义的执行脚本的方法    if (myEditText.getText().toString() != ""){//当用户输入的数据不为空时    //调用translate.html里javascript的translate方法    myWebView.loadU

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android wifi同服务器建立接
    android 中多个页面跳转,以及登陆界面,文件的存储,文件的读取,用户名的注册,
    2022-07-03 20:05:43下载
    积分:1
  • cycledemotwo
    制作一个在Android手机中用的圆形滑动菜单,像老式电话机一样的操作排列方式,有旋转效果。这仅是一个Android菜单,并不包括其它复杂的功能,有兴趣的下载源码包研究一下。(Making a circular slide Android phones using the menu, the same operation as the old-fashioned telephone arrangement, a rotating effect. This is just an Android menu does not include other complex functions, are interested in downloading source package look.)
    2014-04-17 13:44:02下载
    积分:1
  • 视屏录制demo,可以支持usb
    android-eye =========== Change your android phone to a surveillance security camera. ## Download ## You can download binrary from Google Play:  https://play.google.com/store/apps/details?id=teaonly.droideye  ## Specifications ## * Streaming    * Build-in web service, you can see the video via browser in pc and another phone, a modem browser with HTML5 is reauired.   * H.264 video and G.726 audio   * Streaming via websocket between browser and android phone.   * Decoding H.264 and G.726 in pure Javascript * Smart   * Support motion detecting (doing)   * Support advanced vision algorithms (doing)   * Publishing alarm messages to SNS (not ready)     * Access over internet   * This app don"t support internet, you can try my another ap
    2022-11-06 02:50:03下载
    积分:1
  • InternalFileDemo
    android开发文件读写实例demo,用户可在文本框输入文字写入文件,可用追加模式(A Demo of File read/write for Android development.)
    2013-08-16 14:16:28下载
    积分:1
  • vomc
    使用matlab软件里面的simulink仿真OFDM系统(simulation of the ofdm system using the simulink in the matlab software)
    2019-03-27 15:08:09下载
    积分:1
  • 整合手机功能的app
    个人在寒假做的app,比较的low,主要是地图导航,还包含一些手机整合的小工具,当然界面的设计对于我来说比较垃圾,我现在还只是一名初级开发者,刚刚学会如何开发。上传是希望得到前辈们的指点,就此进步。
    2022-02-01 14:24:40下载
    积分:1
  • 音乐播放器
    一个在安卓平台下实现了音乐播放器基本功能的源代码,能够播放MP3格式的音乐文件,可以作为一个例子进行学习
    2022-09-12 09:25:02下载
    积分:1
  • Man20
    是男人就过20秒android源码 欢迎下载(Men over 20 seconds on the android source)
    2012-11-29 16:27:10下载
    积分:1
  • AndroidSMSFilter
    Android平台的短信过滤器,用广播实现,按照来电号码的前缀匹配是否需要过滤。做了前后台切换,用了ListActivity。(SMS filter for Android platform with broadcast, according to the Caller ID prefix match the need for filtering. Do Taiwan before and after the switch, with the ListActivity.)
    2013-03-06 20:19:05下载
    积分:1
  • Android ListView自动检索
    Android ListView自动检索
    2014-10-31下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载