使用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标签控制播放)
随机推荐
- Java开发工具安装步骤内容如下
Java开发工具安装步骤内容如下 安装 开发工具 STS 链接下载网址 eclipse 链接下载网址 JDK安装 jdk链接下载地址 Marven环境 marven链接下载地址 Tomcat tomc ...
- Windows Store App 音频和视频
在Windows应用商店应用中提供了MediaElement控件,该控件能为应用提供音频和视频播放功能.就像之前提到的,虽然在多媒体应用开发中,开发人员可以自行开发一套音频.视频编解码规范和开发媒体播 ...
- 为更好地设计数据库,重新整理sql server数据类型
我们在平常开发过程中,在设计数据的时候,经常碰到数据类型选择的问题,为了更快,更合适地选择正确的数据类型,所以在这里做个总结. 分类 sql server 数据类型 c# 数据类型 描述 应用场景 字 ...
- 实验一 DOS命令解释程序的编写
一.目的和要求 1. 实验目的 (1)认识DOS: (2)掌握命令解释程序的原理: (3)掌握简单的DOS调用方法: (4)掌握C语言编程初步. 2.实验要求 编写类似于DOS,UNIX的命令行解释程 ...
- Ganglia安装搭建
Ganglia的安装部署 前言 1 一.Ganglia组件 1 二.安装依赖 2 三.安装expat依赖 2 四.安装confuse 3 五.安装ganglia 4 六. 服务端配置(gmetad 节 ...
- 洛谷 1004 dp或最大费用流
思路: dp方法: 设dp[i][j][k][l]为两条没有交叉的路径分别走到(i,j)和(k,l)处最大价值. 则转移方程为 dp[i][j][k][l]=max(dp[i-1][j][k-1][l ...
- java给不同步的集合加上同步锁
给非同步的集合加锁: class MyCollections{//创建工具类,提供对外访问方法 public static list synList(List list){ return new My ...
- vs调试时启动多个Development Server
环境:一个解决方案下面有多个项目,当调试其中一个项目时,其他项目也会开启服务,在右下角显示多个图标. 解决方法:选中不想启动的项目,按F4,然后把“总是在调试时启动”设置为Fasle.这样就搞定了.
- MySQL主从同步配置
如果主从配置之前安装了云平台,请停止云平台后在进行mysql主从配置. 1. 登录master数据库,检查数据库端口防火墙设置,允许远程客户连接,如果没有,执行以下操作. 执行命令:iptables ...
- JSOI2016R3 瞎BB题解
题意请看absi大爷的blog http://absi2011.is-programmer.com/posts/200920.html http://absi2011.is-programmer.co ...