使用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. iOS -初识UIKit

    UIKit框架:UI界面上每一个元素都是一个对象 一张图片是UIimageView对象 一段文字是一个UILabei对象 一个按钮是一个UIButton对象 搭建UI界面的步骤 利用类创建对象 将对象 ...

  2. Java8之——简洁优雅的Lambda表达式

    Java8发布之后,Lambda表达式,Stream等等之类的字眼边慢慢出现在我们字眼.就像是Java7出现了之后,大家看到了“钻石语法”,看到了try-with-resource等等.面对这些新东西 ...

  3. oracle常用系统表

    转自:http://blog.chinaunix.net/uid-200142-id-3479306.html dba_开头..... dba_users      数据库用户信息 dba_segme ...

  4. SQLSERVER2008R2数据库的整体导出及单个表的导出步骤

    今天在同事导SQLSERVER数据库中的表的时候遇到一问题,不知道怎么单独的把一个表的建表语句导出来,,迅速百度一下,按照步骤还真导出来了,导出单个表的步骤看下面来啦....: 点中数据库名字---- ...

  5. Android中的几种解析XML文件的类

    Ø DOM解析 优点: 1.XML树在内存中完整存储,因此可以直接修改其数据和结构. 2.可以通过该解析器随时访问XML树中的任何一个节点. 3.DOM解析器的API在使用上也相对比较简单. 缺点:如 ...

  6. POJ 3415 Common Substrings 后缀数组+并查集

    后缀数组,看到网上很多题解都是单调栈,这里提供一个不是单调栈的做法, 首先将两个串 连接起来求height   求完之后按height值从大往小合并.  height值代表的是  sa[i]和sa[i ...

  7. javascript选择排序

    function selectionSort(arr){ var index,value; for(var i = 0;i < arr.length;i ++){ index = i; //先记 ...

  8. Oracle 添加第二个实例 和 监听

    1.添加第二个实例 配置和移植工具 -->Database Configuration Assistant 然后一步一步创建实例(实例名为ORCL2) 创建成功后会在系统的服务里面有个服务名称为 ...

  9. Bootstrap <基础二十二>超大屏幕(Jumbotron)

    Bootstrap 支持的另一个特性,超大屏幕(Jumbotron).顾名思义该组件可以增加标题的大小,并为登陆页面内容添加更多的外边距(margin).使用超大屏幕(Jumbotron)的步骤如下: ...

  10. 查询数据库表大小sql

    SELECT a.name, b.rowsFROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.idWHERE (a.type = ' ...