实现应用WebView组件加载使用HTML代码添加的帮助信息
2016-01-18 20:19
666 查看
1、布局文件
2、MainActivity的onCreate()方法中
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <WebView android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
2、MainActivity的onCreate()方法中
WebView webview = (WebView)findViewById(R.id.webView1);//获取布局管理器中添加的WebView组件 StringBuilder sb = new StringBuilder();//创建一个字符串构建器,将要显示的HTML内容放置在该构建器中 sb.append("<div>选择选项,然后从以下选项中进行选择:</div>"); sb.append("<ul>"); sb.append("<li>编辑内容:用于增加、移动和删除桌面上的快捷工具。</li>"); sb.append("<li>隐藏内容:用于隐藏桌面上的小工具。</li>"); sb.append("<li>显示内容:用于显示桌面上的小工具。</li>"); sb.append("</ul>"); webview.loadDataWithBaseURL(null, sb.toString(), "text/html", "utf-8", null);//加载数据
相关文章推荐
- iOS——button&&imageview的学习笔记
- 通过addDataScheme("file") 浅析android事件过滤策略
- iOS 本地数据持久化 中UserDefault的使用
- Unity学习笔记之UGUI模块RectTransform的变换推导
- 在Android中显示gif图片
- iOS 简易无限滚动的图片轮播器 Demo事例
- 关于Android studio混淆遇到的问题
- 实现应用WebView组件浏览指定网页
- swift 标准库
- 【Android界面实现】使用Canvas对象实现“刮刮乐”效果
- Andorid开发——ListView
- iOS推送与角标总结
- MTK Android手机进程列表
- Android 中编译版本,最小版本, 目标版本都有什么区别?
- ios 中如何处理于Webview 的交互
- Android 调整工作方式 改善耗电问题 <15>
- 【Android源码-PMS】(二)ComponentInfo类
- Android 异常解决 content.ActivityNotFoundException: Unable to find explicit activity class
- 已解决的问题————"struct cocos2d::Color3B const cocos2d::ccRED"
- Androidclient和server端数据交互的第一种方法