请求一个布局的写法。大概描述是这样的!总体是一个LinearLayout包含三个LinearLayout。
分三层。第一个LinearLayout要始终在顶部。
第二个LinearLayout要在中间。
中间的这个LinearLayout肯定要包含其它布局,例如放一个ListView,能上下滑动。而不盖住第三个LinearLayout。
第三个LinearLayout要始终在底部。|------------------------|
| button button | <--第一个LinearLayout
|------------------------|
| |
| 只在此区域内可以 | <--第二个LinearLayout
| 上下滑动,而不影响 |
| 其它布局 |
|------------------------|
| button button | <--第三个LinearLayout
|------------------------|大概描述是这样的请各位前辈指教!如果有其它好的思路方法也可以告知我。谢谢。以下是我写的,请指教<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/widget"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/widget1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/widget2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/widget3" android:gravity="bottom"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect3" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
</LinearLayout>
分三层。第一个LinearLayout要始终在顶部。
第二个LinearLayout要在中间。
中间的这个LinearLayout肯定要包含其它布局,例如放一个ListView,能上下滑动。而不盖住第三个LinearLayout。
第三个LinearLayout要始终在底部。|------------------------|
| button button | <--第一个LinearLayout
|------------------------|
| |
| 只在此区域内可以 | <--第二个LinearLayout
| 上下滑动,而不影响 |
| 其它布局 |
|------------------------|
| button button | <--第三个LinearLayout
|------------------------|大概描述是这样的请各位前辈指教!如果有其它好的思路方法也可以告知我。谢谢。以下是我写的,请指教<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/widget"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/widget1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/widget2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/widget3" android:gravity="bottom"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnSelect3" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="查询" />
</LinearLayout>
</LinearLayout>
解决方案 »
- 用Usb host方式获得usb设备列表为什么为空!!!
- SurfaceView设置背景颜色遮挡问题
- release 版本的apk 为何还会在logcat中输出debug的log呢?
- 有没有办法在锁屏时监听按键?
- 一个app用多个手机连接同一个局域网的无线 出现只有一台能上的情况啊
- ACSII码与二进制相互转化?
- 安卓开发入门问题。。入门好难啊
- ViewPager中使用FragmentStatePagerAdapter刷新Fragment的问题
- 新手求教 android activity模板
- 怎么把Android APP服务器端的代码部署到腾讯云服务器上
- android4.0.3webview中的网页链接选中后不再显示黄框的高亮??
- 文件下载(实现断点续传) Android
不用固定,而且布局中不建议用写死的值。你试一下,第二布局:android:layout_height="wrap_content" android:layout_weight="1.0"
其他两个的高 android:layout_height="wrap_content"我就这样的做的。
这是一种方式,其实就像楼主那样也可以的。我直接用 LinearLayout 都没什么问题。
里面有相对父窗口的布局,只要在你子窗口里加上两个属性就可以相对于父窗口布局了
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/widget"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="@+id/layout_top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="#ffff0000"
>
<Button android:id="@+id/btnSelect1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/layout_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#ff00ff00"
>
<Button android:id="@+id/btnSelect2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="查询" />
</LinearLayout>
<LinearLayout android:id="@+id/layout_center"
android:gravity="bottom"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_above="@id/layout_bottom"
android:layout_below="@id/layout_top"
android:background="#ff0000ff"
>
<Button android:id="@+id/btnSelect3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="查询" />
</LinearLayout>
</RelativeLayout>
相对布局还是很好用的!