一个LinearLayout中有三个元素, 顶部一个head,底部一个footer,中间一个listView。目前出现了个问题,footer没有出现,被listView盖住了。不清楚什么问题,请牛人指点。xml如下:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include layout="@layout/head" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="@layout/main2" />
</FrameLayout>
<FrameLayout
android:id="@+id/fragment_footer"
android:layout_width="match_parent"
android:layout_height="match_parent" > <include layout="@layout/mytab" />
</FrameLayout>
</LinearLayout>下面是layout/main2.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector" /></LinearLayout>
是不是LinearLayout用的有问题,请指点之。
还有两个小问题:
1)fill_parent和match_parent有什么区别;
2)android:layout_gravity和android:gravity有什么区别。多谢了
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include layout="@layout/head" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include layout="@layout/main2" />
</FrameLayout>
<FrameLayout
android:id="@+id/fragment_footer"
android:layout_width="match_parent"
android:layout_height="match_parent" > <include layout="@layout/mytab" />
</FrameLayout>
</LinearLayout>下面是layout/main2.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector" /></LinearLayout>
是不是LinearLayout用的有问题,请指点之。
还有两个小问题:
1)fill_parent和match_parent有什么区别;
2)android:layout_gravity和android:gravity有什么区别。多谢了
解决方案 »
- android 关于gps状态改变 能触发什么广播
- android逐帧动画如何让动画停在最后一张
- android4.0的View.setError()为什么不能显示文字了?
- 请教Android 开发ANT+Wireless怎么在模拟器上运行程序
- 求教listview中单击音乐列表播放音乐的问题啊~~~
- android连接wifi的问题
- 新手,请教android模拟器启动出错?
- AppWidget自定义字体,使用画布方式导致字体过粗
- AccessibilityService 怎么调试?
- android studio android monitor打不开问题
- textview圆角效果
- drawbitmap()函数使用,求助
android:gravity 用来设置控件自身内容在控件中的布局;从Android2.2中match_parent和fill_parent是一个意思,match_parent更贴切。如果考虑低版本的使用情况你就需要用fill_parent了。footer被遮挡的问题,楼主可以考虑用RelativeLayout,或者在LinearLayout中为控件设置layout_weight属性
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <include layout="@layout/head" /> <FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<include layout="@layout/main2" />
</FrameLayout> <include layout="@layout/mytab" /></LinearLayout>
本来是想layout/mytab在运行时使用fragment技术来动态替换的。看来要重新设计设计了。不知道还有什么别的好办法么