简单实现android的WebView
来源:互联网 发布:纸牌游戏算法 编辑:程序博客网 时间:2024/05/17 03:09
废话不多说,直接上代码
首先布局:
<?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:background="@color/bg_webview"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/bg_home_title" >
<TextView
android:id="@+id/wall_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="帮助"
android:textColor="@color/white"
android:textSize="21sp" />
</RelativeLayout>
<WebView
android:id="@+id/setting_help_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@color/bg_webview"
android:cacheColorHint="#00000000"
android:fadingEdge="none"
android:scrollbars="none" />
</LinearLayout>
然后主界面Activity:
package com.suning.mobile.epa.activity.help;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.RenderPriority;
import com.suning.mobile.epa.R;
import com.suning.mobile.epa.RootActivity;
/**
* 设置界面中的帮助界面
*
* @Title:
* @Description:
* @Author:86042765 shenxiaobing
* @Since:2013-6-27
* @Version:
*/
public class SettingHelpActivity extends RootActivity
{
private static final String SETTING_HELP_URL = "file:///android_asset/setting_help.html";
//这个是android工程中assets中的一个html文本。。该文本为:setting_help.html
private WebView mSettingHelpContent;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting_help);
mSettingHelpContent = (WebView) findViewById(R.id.setting_help_content);
// 设置webview 自适应屏幕
mSettingHelpContent.getSettings().setLayoutAlgorithm(
LayoutAlgorithm.SINGLE_COLUMN);
// webview 背景
mSettingHelpContent.setBackgroundColor(getResources().getColor(
R.color.bg_webview));
// 优先加载文字
mSettingHelpContent.getSettings()
.setRenderPriority(RenderPriority.HIGH);
mSettingHelpContent.loadUrl(SETTING_HELP_URL); //实现加载。
}
}
- 简单实现android的WebView
- android:webview实现简单的浏览器
- Android WebView的简单使用,实现标题、加载进度提示
- Android开发--WebView简单录音功能的实现
- Android WebView 设置圆角的简单快速实现
- android编写简单的Webview
- android编写简单的Webview
- Android WebView的简单使用方法
- android的WebView简单实例
- Android WebView的简单使用
- Android WebView的简单实用
- Android WebView的简单使用
- Android WebView的简单使用
- Android WebView的简单使用
- 通过WebView实现简单的浏览器
- 实现简单的web浏览器--WebView
- 74 Android WebView (四) webview的一些简单处理
- 一、Android的webview的简单使用
- Jstl 核心标签库
- SQLSERVER数据库主要状态和切换路径
- ssh框架整合hibernate,spring,struts,dwr等技术过程分析
- Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not
- Android monkey 资料
- 简单实现android的WebView
- CSS 基础:定位元素(3)<思维导图>
- JavaWeb-HttpServletResponse、HttpServletRequest
- JavaWeb-会话
- 黑马程序员--c#堆和堆栈的区别(简介)
- C++中的单例模式
- c++ 进程权限的提升
- 5 个获取 Linux 主机信息的命令
- 自定义tomcat的app项目的404页面