使用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标签控制播放)
随机推荐
- jfinal基本应用 --报主键重复
在使用jfinal 的Model过程中有一个很怪异的问题,发布到服务器上,只要是往表中添加字段,就报主键重复. 1.我添加表的时候调用了 public void create(Map map){ St ...
- ORACLE 空表不能导出问题解决
exp不导出空表,是11g的新特性,当表无数据时,不分配segment,以节省空间,所以exp导出的时候,不导出这些表. 先登录要导出的用户执行以下语句 先执行 select 'alter table ...
- CocoaPods安装流程
iOS 最新版 CocoaPods 的安装流程 1.移除现有Ruby默认源 $gem sources --remove https://rubygems.org/ 2.使用新的源 $g ...
- Debian/Ubuntu/CentOS VPS安装Net-Speeder并优化
安装过程: CentOS安装 wget --no-check-certificate https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/ ...
- java筛选法求素数
这本身没什么,代码一堆 发来纪念下而已 本来刚学习java,编写输出100以内的素数 对于我这个有代码运行性能洁癖的人(但是本身又不懂算法)来说,不能忍 于是看了些资料 参考: http://blog ...
- MSP430FR5739串口程序
今天急着用这个片子的串口,匆忙中调试串口也话费了一段时间,在网上下了一个程序,忽然就把所有问题搞清楚了,只是中断就看着头文件中寄存器写的,虽然通讯正常,不过不确定有没有写错.代码如下: #includ ...
- javascript类继承的一些实验
其实一开始编js没怎么用过对象,一般都用func,func,func···但是用多了,感觉代码一点都不美观,还要这里包一个函数,那里包一个函数,或者一直都是函数调用,不好看,而且一些重用的都要重写的话 ...
- 三、Python 变量、运算符、表达式
3.1 变量 变量是计算机内存中的一块区域,变量可以存储规定范围内的值,值可以改变,其实是将值在内存中保存地址位交给变量,变量去内存中获取,重新赋值,改变的就是内存地址位. 命名: 变量名由字母.数字 ...
- Switch图形练习
//package IfAndSwitchs;import java.util.Scanner; public class Mianji { public static void main(Strin ...
- IE关闭兼容性视图
不知道什么时候,ie8的“兼容性视图设置”变成了灰色,如图: 今天通过设置组策略,终以解决了这个问题: ie8的兼容性视图设置灰色的解决办法:运行gpedit.msc--用户配置/计算机配置--管理 ...