使用RelativeLayout控制WebView以及Bottom按钮的位置 (地址

在Design View中加入控件RelativeLayout, WebView, LinearLayout(Horizontal), Button, Button

  1. 添加新Layout - WebViewLayout.axml, 打开文件。 选中默认的LinearLayout并删除。
  2. 添加RelativeLayout, 在Toolbox中拖动RelativeLayout控件到页面中。
  3. 拖动WebView控件到RelativeLayout中。
  4. 拖动LinearLayout(Horizontal)到RelativeLayout中, 置于WebView之下。
  5. 拖动两个Button到LinearLayout(Horizontal)中。

完成以上步骤以后,页面源代码如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:id="@+id/relativeLayout1">
<WebView
p1:layout_width="wrap_content"
p1:layout_height="wrap_content"
p1:id="@+id/webView1" />
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="wrap_content"
p1:layout_height="wrap_content"
p1:layout_below="@id/webView1"
p1:id="@+id/linearLayout1">
<Button
p1:text="Button"
p1:layout_width="wrap_content"
p1:layout_height="match_parent"
p1:id="@+id/button2" />
<Button
p1:text="Button"
p1:layout_width="wrap_content"
p1:layout_height="match_parent"
p1:id="@+id/button1" />
</LinearLayout>
</RelativeLayout>

切换到Source View, 实现如下修改:

  1. 在WebView中,加入位置属性。

    p1:layout_above="@+id/linearLayout1"
  2. 修改WebView的layout_width, layout_height属性为fill_parent

    p1:layout_width="fill_parent"
    p1:layout_height="fill_parent"
  3. 添加LinearLayout的layout_alignParentBottom属性。

    p1:layout_alignParentBottom="true"
  4. 修改LinearLayout的layout_width, layout_height属性。

    p1:layout_width="match_parent"
    p1:layout_height="wrap_content"
  5. 为了使两个Button平分空间, 加入layout_weight属性。

    p1:layout_weight="0.5"

修改后的源代码如下:

  <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:id="@+id/relativeLayout1">
<WebView
p1:layout_width="fill_parent"
p1:layout_height="fill_parent"
p1:id="@+id/webView1"
p1:layout_above="@+id/linearLayout1" />
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:layout_below="@id/webView1"
p1:id="@+id/linearLayout1"
p1:layout_alignParentBottom="true">
<Button
p1:text="Button"
p1:layout_width="wrap_content"
p1:layout_height="match_parent"
p1:id="@+id/button2"
p1:layout_weight="0.5" />
<Button
p1:text="Button"
p1:layout_width="wrap_content"
p1:layout_height="match_parent"
p1:id="@+id/button1"
p1:layout_weight="0.5" />
</LinearLayout>
</RelativeLayout>

使用RelativeLayout控制WebView以及Bottom按钮的位置的更多相关文章

  1. AppBoxPro - 细粒度通用权限管理框架(可控制表格行内按钮)源码提供下载

    特别声明: 提供的源代码已经包含了 AppBoxPro 的全部源代码,用 VS2012 打开项目后,直接 Ctrl+F5 可以运行起来(默认使用VS自带的LocalDB数据库). FineUIPro是 ...

  2. elementUI 的el-dialog作为子组件,父组件如何控制其关闭的按钮

    这里有三点需要说明: 1. 使用:before-close="closeHandle" 将其 $emit() 出去 2. 取消按钮 也需要$emeit出去 3. 控制对话框显示隐藏 ...

  3. scroll与按钮的位置

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. jQuery实现两个按钮的位置互换

    页面上有2个按钮A和B.点击按钮A和按钮B互换位置 ,点击按钮B和按钮A互换位置.应该如何实现? html代码如下: <body> <!--页面上有2个按钮A和B. 点击按钮A和按钮 ...

  5. 控制图片在latex中的位置

    如何做到自己控制图片在latex中的位置? 方法:在 \begin{figure} 后面加参数 [h!] 即 \begin{figure}[h!] % Requires \usepackage{gra ...

  6. Dynamic CRM 2013学习笔记(十八)根据主表状态用JS控制子表自定义按钮

    有时要根据主表的审批状态来控制子表上的按钮要不要显示,比如我们有一个需求审批通过后就不能再上传文件了. 首先打开Visual Ribbon Editor, 如下图,我们可以利用Enable Rules ...

  7. android webview重定向 返回按钮死循环问题修改

    当HTML有重定向的时候,回退时会不断往跳转进入死循环.尝试修改webview缓存加载策略以后,不起作用.在网上查阅资料以后,跟 shouldOverrideUrlLoading的返回值为true还是 ...

  8. Android--用JS去控制WebView显示的字体的大小

    <script type="text/javascript"> function changeFontSize(size) { var tfs = '120%'; va ...

  9. js控制“鼠标点击按钮后,按钮消失“(可以自己添加video标签控制播放)

随机推荐

  1. Java代理模式/静态代理/动态代理

    代理模式:即Proxy Pattern,常用的设计模式之一.代理模式的主要作用是为其他对象提供一种代理以控制对这个对象的访问. 代理概念 :为某个对象提供一个代理,以控制对这个对象的访问. 代理类和委 ...

  2. nmon--非常棒的LINUX/AIX性能计数器监测和分析工具

    转自51Testinghttp://bbs.51testing.com/viewthread.php?tid=116526 经常看到很多人讨论说loadrunner对linux/aix的性能监测太少, ...

  3. vs安装后当切换到图形设计界面的时候自动弹出“正在准备安装的提升”,然后程序处于假死状态

    Vs2008 安装后当切换到图形设计界面的时候自动弹出 ”正在准备安装的提示“,然后程序处于假死状态 在网上找了很多,最终解决问题:  从vs2008安装光盘中找到 /WCU/WebDesignerC ...

  4. 【转】responseText,responseBody,responseXML差别

    为了做ajax的代理,研究了下服务器端的xmlhttp和客户端ajax中的xmlhttp,做了个比较 由于我一直使用JavaScript作为Asp的教本语言,所以比较起来更清楚.服务器端的xmlhtt ...

  5. MicroERP开发技术分享:技术选型

    为什么要想起开发一个近似一套完整的ERP软件呢,原因有二:一是想在空闲时间把以前的进销存软件丰富一下,结果越搞越大了:二是这些年光搞C#了,不想把VB6忘光了 非微软的东西还真没时间去学,也有主要原因 ...

  6. CentOS 静态IP设置

    一.CentOS 修改IP地址修改对应网卡的IP地址的配置文件 # vi /etc/sysconfig/network-scripts/ifcfg-eth0   电信 # vi /etc/syscon ...

  7. Linux学习 :移植U-boot_2016.09到JZ2440开发板

    一.下载源码:ftp://ftp.denx.de/pub/u-boot/ 二.初始化编译: ①新建一个单板: cd board/samsung/ cp smdk2410 smdk2440 -rf   ...

  8. linux基本常用命令列举

    上回装完虚拟机中的linux系统了,进入找到terminal,打开命令行界面 pwd:展示目前为止绝对路径 cd cd~:跳转到/home/yy的位置 cd-:跳转到上一步的位置 cd path(绝对 ...

  9. javafx之HTTP协议交互

    javafx端要获取获取如下信息: 服务器端获取的数据: javafx客户端发送的数据以及获取的数据: 工程目录: package Httputil; import IPsite.IPaddress; ...

  10. asp.net DataTable 修改列值

    /// <summary> /// 修改数据表DataTable某一列的类型和记录值(正确步骤:1.克隆表结构,2.修改列类型,3.修改记录值,4.返回结果) /// </summa ...