三个控件,button1,web,button2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button1"/>
<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/but1"/>
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/web"
android:text="Button2" /></RelativeLayout>
因为加载的网页太大,button2不能显示
如何能让button1在顶部显示,button2在底部显示,而无论网页大小如何,WebView都只且占据两个button中间的空间?Android布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button1"/>
<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/but1"/>
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/web"
android:text="Button2" /></RelativeLayout>
因为加载的网页太大,button2不能显示
如何能让button1在顶部显示,button2在底部显示,而无论网页大小如何,WebView都只且占据两个button中间的空间?Android布局
解决方案 »
- 程序运行不了
- android上百源码分析和源码合集
- 关于服务器端接口地址保存的问题
- 求大虾帮忙啊,关于service后台更新IU问题!!
- 关于安卓做的闹钟问题
- 如何判断 findViewById(R.id.img1) 是否有此值或有此控件,在线等
- webView 当网页超过屏幕长度时往下拉网页,webView的显示问题
- 关于Android中的OnJetEventListener
- Android 传感器使用的时候需要校准吗
- 怎么样才能这样listItemView.image.setVisibility(View.VISIBLE);
- XMPP无法连接Openfire Server服务器
- WebView第一次加载会白屏,求解决方案
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Button" /> <Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Button" /> <WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button2"
android:layout_alignParentLeft="true"
android:layout_below="@+id/button1" /></RelativeLayout>
button1
android:layout_alignParentTop="true"button2
android:layout_alignParentBottom="true"webview
android:layout_below="@+id/button1"
android:layout_above="@+id/button2"
让webView有属性android:layout_above="@id/button2"
这样只需给WebView加一个layout_weight=1即可,它占据剩下的布局空间