请教一个关于xml 布局的问题 本帖最后由 itakeblue 于 2011-08-05 01:06:36 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个需要动态实现。建议看一下:http://www.cnblogs.com/and_he/archive/2011/05/30/2063230.html 动态加载我已经实现了,我现在就是想有一个元素,比如说一张图片,怎么出现在listview的底端,xml里面怎么写可以实现。。 用RelativeLayout试试看:<RelativeLayout......> <ListView android:id="@+id/list" android:layout_alignParentTop="true"..../> //ListView 放在最上面 <LinearLayout android:layout_below="@id/list"...></LinearLayout> //LinearLayout在ListView的下面</RelativeLayout> LinearLayout 始终显示在屏幕的正中央,和listview叠加在一起。。 把下面的LinearLayout的属性如下:去掉 android:layout_below,加上android:layout_alignParentBottom="true" 还是LinearLayout 始终显示在屏幕的正中央,和listview叠加在一起我刚试了LinearLayout的layout_weight为0,listview的layout_weight为1然后LinearLayout就始终保持在屏幕底部,感觉LinearLayout不能接在listview底端显示的。可能还是要用程序动态增加一个列表项在listview最后吧 我觉得应该这样实现: <RelativeLayout......> <LinearLayout android:layout_alignParentBottom="true" andriod:id="@+id/load" android:visible="gone"...></LinearLayout> //LinearLayout在容器底部,平时隐藏 <ListView android:layout_above="@id/load"...></ListView></RelativeLayout> 当ListView到达底部的时候,才把LinearLayout显示出来。 是的,不过现在是先不说LinearLayout隐藏或者显示,而是LinearLayout总是不能出现在listview的底端。 <?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/listview" android:visibility="gone"/> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/loading" android:gravity="center"> <ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dip"> </ProgressBar> <TextView android:text="@string/loading" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout></FrameLayout>最外层用<FrameLayout></FrameLayout>布局,先让listview的visibility属性为gone,主要就是让listview和下面同级的linearlayout轮流显示通过设置它们的visibility属性(具体的看自己的需要),不过这样比较麻烦给你个参照例子看下:http://www.eoeandroid.com/thread-78646-1-5.html 大概明白你的意思了:尝试一下函数onScrollStateChanged(AbsListView view, int scrollState)当状态为:SCROLL_STATE_IDLE的时候做加载linearlayout的内容。 android开发进阶问题 android如何实现Iphone的coverflow,求demo,急急急急急急急急 如何引用一个静态数组里边的值 关于正则表达一问 请教Android应用程序开发 搭建Android环境时遇到的问题,感激不尽 android studio 找不到荣耀9真机 assets资源文件太大,调试的时候打包下载太慢怎么解决 【求助】请问用这个线性布局调用结合弹性布局,弹性布局会变型题的怎么解决,感谢新任积分少见谅 Android studio出现error android 导入org.htmlparser的问题 android 自定义控件实现走马灯效果(急)
建议看一下:http://www.cnblogs.com/and_he/archive/2011/05/30/2063230.html
动态加载我已经实现了,我现在就是想有一个元素,比如说一张图片,怎么出现在listview的底端,xml里面怎么写可以实现。。
<ListView android:id="@+id/list" android:layout_alignParentTop="true"..../> //ListView 放在最上面
<LinearLayout android:layout_below="@id/list"...></LinearLayout> //LinearLayout在ListView的下面
</RelativeLayout>
LinearLayout 始终显示在屏幕的正中央,和listview叠加在一起。。
把下面的LinearLayout的属性如下:
去掉 android:layout_below,加上android:layout_alignParentBottom="true"
还是LinearLayout 始终显示在屏幕的正中央,和listview叠加在一起我刚试了LinearLayout的layout_weight为0,listview的layout_weight为1
然后LinearLayout就始终保持在屏幕底部,感觉LinearLayout不能接在listview底端显示的。可能还是要用程序动态增加一个列表项在listview最后吧
<RelativeLayout......>
<LinearLayout android:layout_alignParentBottom="true" andriod:id="@+id/load" android:visible="gone"...></LinearLayout> //LinearLayout在容器底部,平时隐藏
<ListView android:layout_above="@id/load"...></ListView>
</RelativeLayout>
当ListView到达底部的时候,才把LinearLayout显示出来。
是的,不过现在是先不说LinearLayout隐藏或者显示,而是LinearLayout总是不能出现在listview的底端。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" > <ListView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/listview"
android:visibility="gone"/> <LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/loading"
android:gravity="center"> <ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip">
</ProgressBar> <TextView
android:text="@string/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout></FrameLayout>
最外层用<FrameLayout></FrameLayout>布局,先让listview的visibility属性为gone,主要就是让listview和下面同级的linearlayout轮流显示通过设置它们的visibility属性(具体的看自己的需要),不过这样比较麻烦给你个参照例子看下:
http://www.eoeandroid.com/thread-78646-1-5.html
尝试一下函数onScrollStateChanged(AbsListView view, int scrollState)
当状态为:
SCROLL_STATE_IDLE
的时候做加载linearlayout的内容。