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. C#基础01

    ASP.net基础详情 1:Momo就是跨平台的一种.net,借助其Momo可以让其.net网站跑到Lumin和安卓机上面. 2:开发的网站具有安全,速度快,容易配置. 3:互联网开发[网站]和管理系 ...

  2. 数学 - Whu 1603 - Minimum Sum

    Minimum Sum Problem's Link ------------------------------------------------------------------------- ...

  3. 一个比较有意思的C语言问题

    先看代码吧,学习c语言结构体中看到的一个问题 #include<stdio.h> int main(){ struct{ int a:2; }x; x.a=; x.a=x.a+; prin ...

  4. IIS 部署WCF 4.0

    上一章节讲解如何新建WCF服务,此文讲解如何在IIS上发布,并能正常访问 本地部署IIS 首先在本机安装IIS,IIS如何勾选,哪些是必须的?不太清楚,有清楚的大牛请指正!目前我的基本配置如下: 配置 ...

  5. 水晶报表13.x(Crystal Reports for VS2010)的安装部署经验

    这两天搞安装包真心坎坷,一个问题接一个问题,先是为了实现自定义动作现啃vbs,后面又是安装过程老是报错: 各种搜索.各种尝试,总算搞掂,积累了些经验,分享一下. 首先CR for VS2010的所有东 ...

  6. Stream/Bytes[]/Image对象相互转化

    Stream/Bytes[]/Image对象相互转化 Stream转Byte数组.Image转Byte数组.文件转Stream等 /// <summary> /// 将 Stream 转成 ...

  7. CSS——4种定位

    若是没有指定定位方式,默认为静态定位. 1.静态定位(static) 静态定位会将所有元素正常流入页面. 2.绝对定位(absolute) 绝对定位将元素完全从页面流中取出,允许你为他制定一个绝对的位 ...

  8. ahjesus配置vsftpd虚拟用户在Ubuntu

    网上搜索了很多资料,过时,不全,货不对版 已下步骤亲测有效,不包含匿名用户登录 1.新建/home/loguser.txt 并填充内容,格式如下 用户名密码用户名密码用户名密码 2.生成db文件用于用 ...

  9. testng对失败时截图处理

    1.截图类: public class ScreenShot { public WebDriver driver; public ScreenShot(WebDriver driver) { this ...

  10. rabbitmq启动异常之error,{not_a_dets_file recovery.dets

    中午,公司群里面测试人员@笔者说,早上测试服务器异常,MQ起不来,重启os了也起不来,报错,上去看下了早上又因为内存oom被内核killed了,启动了下,确实启动报错,erl vm进程起来了,但是be ...