web view在安卓开发中是比较常见的UI,像微信的新闻模块就采用了这个,他的作用越来越广,下面我把以前做的贴了出来,如果有更好的办法,希望大神不吝赐教哈,嘿嘿,纯代码来了:

java代码

public class GuanYuWoMen extends Activity {

WebView webView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(android.view.Window.FEATURE_NO_TITLE);
setContentView(R.layout.guanyuruanjian);
WebView webview = (WebView)findViewById(R.id.web);
// WebSettings webSettings= webView.getSettings();

//支持javascript
webview.getSettings().setJavaScriptEnabled(true);
// 设置可以支持缩放
webview.getSettings().setSupportZoom(true);
// 设置出现缩放工具
webview.getSettings().setBuiltInZoomControls(true);
//扩大比例的缩放
webview.getSettings().setUseWideViewPort(true);
//自适应屏幕
webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
webview.getSettings().setLoadWithOverviewMode(true);

webview.getSettings().setUseWideViewPort(true);

/*
* 加载网页进度条
* */
webview.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress) {
//Activity和Webview根据加载程度决定进度条的进度大小
//当加载到100%的时候 进度条自动消失
GuanYuWoMen.this.setProgress(progress * 100);

ProgressBar loadingProgress=(ProgressBar)findViewById(R.id.pgs);//此控件为一个进度条控件,属于自己添加的控件这个样式是可以进行改变的
loadingProgress.setProgress(progress);
if (progress==100) {
loadingProgress.setVisibility(loadingProgress.GONE);
}
super.onProgressChanged(view, progress);

}
});
webview.loadUrl("http://www.buiqu.com/");

}
}

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C6C6C6"
android:orientation="vertical" >

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/title_beijing" >

<ImageView
android:id="@+id/img_shezhi_fanhui"
android:layout_width="45dp"
android:background="@drawable/fanhui"
android:layout_marginLeft="5dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textColor="#fff"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_centerInParent="true"
android:text="@string/shezhi"
android:textSize="20dp" />
</RelativeLayout>

<LinearLayout
android:layout_marginTop="10dp"
android:id="@+id/layout_xiugaiphone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="15sp"
android:text="@string/xiugai_phone"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:text=">"
android:textSize="18dp" />
</LinearLayout>

<LinearLayout
android:layout_marginTop="10dp"
android:id="@+id/layout_shezhianquanwenti"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="15sp"
android:text="@string/shezhianquanwenti"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:text=">"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="10dp"
android:id="@+id/layout_guanyuwomen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >

<TextView
android:id="@+id/gywm_gywm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="15sp"
android:layout_marginLeft="5dp"
android:text="关于我们"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:text=">"
android:textSize="18dp" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="10dp"
android:id="@+id/layout_zhanghao"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="15sp"
android:text="@string/tuichu"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:text=">"
android:textSize="18dp" />
</LinearLayout>

<LinearLayout
android:layout_marginTop="10dp"
android:id="@+id/layout_chengxun"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal" >

<TextView
android:id="@+id/gywm_tcyy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="15sp"
android:layout_marginLeft="5dp"
android:text="@string/tuichuyingyong"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:text=">"
android:textSize="18dp" />
</LinearLayout>

</LinearLayout>

安卓开发之UIwebview的更多相关文章

  1. 安卓开发之Toolbar

    根据官网的教程,发现实现与预期不一致,查看相关资料自己整理了一下(官网开发文档:https://developer.android.com/training/appbar/setting-up.htm ...

  2. 安卓开发之ListAdapter(二)

    今天我们来学习一下ArrayAdapter: ArrayAdapter是安卓中最简单的适配器.使用ArrayAdapter(数组适配器),需要把数据源存 放至数组里面来显示. •构造函数: publi ...

  3. iOS开发之UIWebView自动滑动到顶部-备

    但可以通过subview来操作. 通常用UIWebView加载网页,有时候需要点击一个按钮,或者页面的某个部位,使页面自动滚动到顶部,但是UIWebView不像UIScrollView那么方便.   ...

  4. iOS开发之UIWebView的常见一些用法

    虽然现在Xcode8已经开始使用WKWebView这个框架进行网页展示,但是UIWebView也有一些常用的方法需要知道,下面就简单展示一下,仅供大家参考 相关知识:1.设置背景透明:2.加载本地HT ...

  5. iOS开发之UIWebView

    转自:http://www.cnblogs.com/zhuqil/archive/2011/07/28/2119923.html UIWebView是iOS sdk中一个最常用的控件.是内置的浏览器控 ...

  6. 安卓开发之activity详解(sumzom)

    app中,一个activity通常是指的一个单独的屏幕,相当于网站里面的一个网页,它是对用户可见的,它上面可以显示一些控件,并且可以监听处理用户的时间做出响应. 那么activity之间如何进行通信呢 ...

  7. 安卓开发之ListAdapter(一)

    Adapter常用来管理数据,是连接后端数据和前端显示的适配器接口,是数据和UI(view)之间一个重要的纽带.再常见的view(listview.gridview)等地方都需要用到adapter,下 ...

  8. 安卓开发之json解析

    1.从网页获取json返回字符串 public class ReadNet extends AsyncTask<URL, Integer, String> { @Override      ...

  9. 安卓开发之viewpager学习(头条显示)

    activity_luancher.xml代码如下: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res ...

随机推荐

  1. RegularHelper

    private const string m_NumberPattm = @"^[-+]?(0{1}|(([1-9]){1}[0-9]{0,6}))?$"; private con ...

  2. mvc url 伪静态

    WebConfig配置 <system.webServer> <validation validateIntegratedModeConfiguration="false& ...

  3. C#写快速排序

    //先上快排代码------------------------------------------------------------------------public static void Q ...

  4. jQuery 3.0正式发布

    jQuery 基金会刚刚发布了该 JavaScript 框架的 3.0 版本,并且首次抛弃了对老旧的 IE 浏览器的支持.jQuery 3.0 的工作始于 2014 年 10 月,其最初目标是在 2. ...

  5. 【C#】VS2015开发环境的安装和配置(二)2016-08-03更新

    分类:C#.VS2015.WPF.ASP.NET MVC.Android.iOS.Unity3D: 更新日期:2016-08-03 按下面介绍的步骤安装即可. 一.安装JDK和Android SDK ...

  6. mysql笔记第三天

    一下午在学习mysql,最有价值的就是这一点点 Order by 可以对在select字句中出现的字段位置进行排列eg:select name,count(*) from eg group by na ...

  7. MUI(2)

    本篇博文是继续MUI(1)博文. 上一篇博文小编写了两个页面,一个页面只写了一个头部导航栏,另一个页面写了一个按钮,然后这两个页面进行合并显示,即在头部导航栏页面加载显示另一个页面的按钮.仔细观察上一 ...

  8. 高性能 Windows Socket 组件 HP-Socket v3.0.1 正式发布

    HP-Socket 是一套通用的高性能 Windows Socket 组件包,包含服务端组件(IOCP 模型)和客户端组件(Event Select 模型),广泛适用于 Windows 平台的 TCP ...

  9. HTML+AngularJS+Groovy如何实现登录功能

    AngularJS是一款优秀的前端JS框架,已经被用于Google的多款产品当中.AngularJS核心特性有:MVVM.模块化.自动化双向数据绑定.语义化标签.依赖注入等.AngularJS认为声明 ...

  10. Space.js – HTML 驱动的页面 3D 滚动效果

    为了让我们的信息能够有效地沟通,我们需要创建用户和我们的媒体之间的强有力的联系.今天我们就来探讨在网络上呈现故事的新方法,并为此创造了一个开源和免费使用的 JavaScript 库称为 space.j ...