使用RelativeLayout控制WebView以及Bottom按钮的位置
使用RelativeLayout控制WebView以及Bottom按钮的位置 (地址)
在Design View中加入控件RelativeLayout, WebView, LinearLayout(Horizontal), Button, Button。
- 添加新Layout -
WebViewLayout.axml, 打开文件。 选中默认的LinearLayout并删除。 - 添加RelativeLayout, 在Toolbox中拖动RelativeLayout控件到页面中。
- 拖动WebView控件到RelativeLayout中。
- 拖动LinearLayout(Horizontal)到RelativeLayout中, 置于WebView之下。
- 拖动两个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, 实现如下修改:
在WebView中,加入位置属性。
p1:layout_above="@+id/linearLayout1"
修改WebView的layout_width, layout_height属性为
fill_parent。p1:layout_width="fill_parent"
p1:layout_height="fill_parent"
添加LinearLayout的
layout_alignParentBottom属性。p1:layout_alignParentBottom="true"
修改LinearLayout的layout_width, layout_height属性。
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
为了使两个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按钮的位置的更多相关文章
- AppBoxPro - 细粒度通用权限管理框架(可控制表格行内按钮)源码提供下载
特别声明: 提供的源代码已经包含了 AppBoxPro 的全部源代码,用 VS2012 打开项目后,直接 Ctrl+F5 可以运行起来(默认使用VS自带的LocalDB数据库). FineUIPro是 ...
- elementUI 的el-dialog作为子组件,父组件如何控制其关闭的按钮
这里有三点需要说明: 1. 使用:before-close="closeHandle" 将其 $emit() 出去 2. 取消按钮 也需要$emeit出去 3. 控制对话框显示隐藏 ...
- scroll与按钮的位置
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- jQuery实现两个按钮的位置互换
页面上有2个按钮A和B.点击按钮A和按钮B互换位置 ,点击按钮B和按钮A互换位置.应该如何实现? html代码如下: <body> <!--页面上有2个按钮A和B. 点击按钮A和按钮 ...
- 控制图片在latex中的位置
如何做到自己控制图片在latex中的位置? 方法:在 \begin{figure} 后面加参数 [h!] 即 \begin{figure}[h!] % Requires \usepackage{gra ...
- Dynamic CRM 2013学习笔记(十八)根据主表状态用JS控制子表自定义按钮
有时要根据主表的审批状态来控制子表上的按钮要不要显示,比如我们有一个需求审批通过后就不能再上传文件了. 首先打开Visual Ribbon Editor, 如下图,我们可以利用Enable Rules ...
- android webview重定向 返回按钮死循环问题修改
当HTML有重定向的时候,回退时会不断往跳转进入死循环.尝试修改webview缓存加载策略以后,不起作用.在网上查阅资料以后,跟 shouldOverrideUrlLoading的返回值为true还是 ...
- Android--用JS去控制WebView显示的字体的大小
<script type="text/javascript"> function changeFontSize(size) { var tfs = '120%'; va ...
- js控制“鼠标点击按钮后,按钮消失“(可以自己添加video标签控制播放)
随机推荐
- oracle常用系统表
转自:http://blog.chinaunix.net/uid-200142-id-3479306.html dba_开头..... dba_users 数据库用户信息 dba_segme ...
- .net中的序列化
常见的序列化格式和方法 在.net中,常见的序列化格式主要有json,二进制和xml,总结如下表格. 注意事项 关于实体特性标注规则: 1,.net中所有用于序列化的实体的class上应该加上[Ser ...
- 深入理解iOS开发中的BitCode功能
前言 做iOS开发的朋友们都知道,目前最新的Xcode7,新建项目默认就打开了bitcode设置.而且大部分开发者都被这个突如其来的bitcode功能给坑过导致项目编译失败,而这些因为bitcode而 ...
- 荣品RP4412开发板烧写Ubuntu系统应注意SD卡内存大些
问:RP4412开发板用SD卡烧写光盘中的fastboot失败,现在如何补救呢? 答:INAND格式化, 利用usb来升级啊, 也有文档,看升级文档. 问: 这个是怎么回事? 答:你是升级什么系统? ...
- Pycharm快捷方式
PYCHARM的快捷方式 PyCharm3.0默认快捷键(翻译的)1.编辑(Editing)Ctrl + Space 基本的代码完成(类.方法.属性)Ctrl + Alt + Space 快速导入任意 ...
- sqlserver行列转换问题(网上搜集)
(列->行) 一.FOR XML PATH 简单介绍 那么还是首先来介绍一下FOR XML PATH ,假设现在有一张兴趣爱好表(hobby)用来存放兴趣爱好,表结构如 ...
- 计算机网络(13)-----java nio手动实现简单的http服务器
java nio手动实现简单的http服务器 需求分析 最近在学习HTTP协议,还是希望动手去做一做,所以就自己实现了一个http服务器,主要功能是将http请求封装httpRequest,通过解析 ...
- Websocket 协议解析
WebSocket protocol 是HTML5一种新的协议.它是实现了浏览器与服务器全双工通信(full-duplex). 现 很多网站为了实现即时通讯,所用的技术都是轮询(po ...
- 如何使用.NET开发全版本支持的Outlook插件产品(四)——进阶探讨
插件项目所有代码都已经上传至 https://github.com/VanPan/TestOutlookAdding 如何定制Ribbon在不同界面的显示 实际使用过程中出现的问题 这个问题的来自十分 ...
- Ajax读取txt并对txt内容进行分页显示
function TransferString(content) { var string = content; try{ string=string.replace(/\r\n/g,"&l ...