复写一个listView ,在你布局文件中使用此view:

  1. <ScrollView
  2. android:layout_width="fill_parent"
  3. android:layout_height="wrap_content"
  4. android:layout_marginTop="@dimen/size_30_dp"
  5. android:fadingEdge="none" >
  6.  
  7. <LinearLayout
  8. android:layout_width="fill_parent"
  9. android:layout_height="wrap_content"
  10. android:gravity="center_horizontal"
  11. android:orientation="vertical" >
  12.  
  13. <TextView
  14. android:layout_width="wrap_content"
  15. android:layout_height="wrap_content"
  16. android:layout_gravity="left"
  17. android:layout_marginLeft="@dimen/size_12_dp"
  18. android:text="@string/text_task_personal"
  19. android:textColor="@color/text_task_personal_color"
  20. android:textSize="@dimen/size_16" />
  21.  
  22. <com.xxx.view.MyListView
  23. android:id="@+id/gtask_listview_doing"
  24. style="@style/inventory_view_list_style"
  25. android:layout_width="fill_parent"
  26. android:layout_height="wrap_content"
  27. android:layout_marginTop="@dimen/detail_top"
  28. android:background="@color/white" />
  29.  
  30. <TextView
  31. android:layout_width="wrap_content"
  32. android:layout_height="wrap_content"
  33. android:layout_gravity="left"
  34. android:layout_marginLeft="@dimen/size_12_dp"
  35. android:text="@string/text_task_team"
  36. android:textColor="@color/text_task_team_color"
  37. android:textSize="@dimen/size_16" />
  38.  
  39. <com.xxx.view.MyListView
  40. android:id="@+id/gtask_listview_finished"
  41. style="@style/inventory_view_list_style"
  42. android:layout_width="fill_parent"
  43. android:layout_height="wrap_content"
  44. android:layout_marginBottom="@dimen/detail_top"
  45. android:background="@color/white" />
  46. </LinearLayout>
  47. </ScrollView>

java代码:

  1. package com.xxx.view;
  2. import android.content.Context;
  3. import android.widget.ListView;
  4.  
  5. public class MyListView extends ListView {
  6. public MyListView(Context context) {
  7. super(context);
  8. }
  9.  
  10. public MyListView(Context context, android.util.AttributeSet attrs) {
  11. super(context, attrs);
  12. }
  13.  
  14. public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  15. int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE>> , MeasureSpec.AT_MOST);
  16. super.onMeasure(widthMeasureSpec, expandSpec);
  17. }
  18. }

Android如何在一个线性布局里完美显示两个listview啊?的更多相关文章

  1. Android 自学之线性布局 LinearLayout

    线性布局(LinearLayout),线性布局有点想AWT编程里面的FolwLayout,他们都会将容器里面的组件挨个的排列起来. 他们最大的区别在于:Android的线性布局不会换行:AWT里面的F ...

  2. Android开发之线性布局详解(布局权重)

    布局权重 线性布局支持给个别的子视图设定权重,通过android:layout_weight属性.就一个视图在屏幕上占多大的空间而言,这个属性给其设 定了一个重要的值.一个大的权重值,允许它扩大到填充 ...

  3. .Net程序猿玩转Android开发---(6)线性布局LinearLayout

                                LinearLayout控件是Android中重要的布局控件,是一个线性控件,所谓线性控件的意思是指该控件里面的内容仅仅能水平或垂直排列.也就 ...

  4. android 59 LinearLayout 线性布局

    ##常见的布局* LinearLayout 线性布局线性布局往左右拉是拉不动的,> 线性布局的朝向 vertical|horizontal> 线性布局的权重 weight 和 0dip一起 ...

  5. android学习之线性布局

    效图如下 移通152余继彪 该布局使用了线性布局完成 父布局为线性布局,黄色和灰色部分为水平的线性布局,剩余50%部分为水平线性布局,该布局中包含了两个垂直的线性布局分别占了三分之1和三分之二

  6. Android之Linearlayouy线性布局

    写了个小例子xml代码如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout x ...

  7. Android之LinearLayout线性布局

    1.相关术语解释 orientation 子控件的排列方式,horizontal(水平)和vertical(垂直默认)两种方式! gravity 子控件的对齐方式,多个组合 layout_gravit ...

  8. Android开发:在布局里移动ImageView控件

    在做一个app时碰到需要移动一个图案的位置,查了一上午资料都没找到demo,自己写一个吧 RelativeLayout.LayoutParams lp = new RelativeLayout.Lay ...

  9. Android——学习:线性布局权重分配

    LinearLayout在Android中被广泛使用,LinearLayout有一个比较重要的属性——android:layout_weight.按照字面理解就是该控件的权重,这个值默认是 零(0). ...

随机推荐

  1. Asp.net上传出现“超过了最大请求长度”的问题解决方法

    在开发ASP.NET网站后台管理系统时,我们可能会遇到这样的问题:上传大于4M的文件时,会提示错误:错误信息如下: 1.异常详细信息:超过了最大请求长度. 2.引发异常的方法:Byte[] GetEn ...

  2. js 获取当前时间格式怎么转换?

    toLocaleDateString() 得到的时间是 yyyy年MM月dd日 HH:ss:mm 格式的,怎么转换成yyyy-MM-dd HH:ss:mm 在js里面 仅针对这个问题来说,不需要那么大 ...

  3. 用 C# 如何判断数据库中是否存在一个值

    选定一个列,比如用户编号列 //欲插入的用户编号string ll_userID="xxxxxxxx"; //查询此编号是否存在SqlCommand mycmd = new Sql ...

  4. import com.sun.image.codec.jpeg.JPEGCodec不通过 Eclipse找不到包

    Eclipse默认把这些受访问限制的API设成了ERROR.只要把Windows-Preferences-Java-Complicer-Errors/Warnings里面的Deprecated and ...

  5. android开发者博客二月Android Studio2.0测试

    参考网页-http://android-developers.blogspot.com/2016/02/android-studio-20-beta.html Android Studio 2.0-B ...

  6. Android Activity的生命周期详解

    应用程序中,一个Activity通常就是一个单独的屏幕,它上面可以显示一些控件也可以监听并处理用户的事件做出响应. Activity之间通过Intent进行通信.在Intent 的描述结构中,有两个最 ...

  7. MVC小系列(五)【在过滤器里引入重定向】

    在过滤器里引入重定向 过滤器的引入:如果用户进行一个操作,但没有登录,可以在Post方法上加个过滤器以验证用户是否登录,如果登录成功,则继续进行操作,如果没有登录,则实现Url的重定向,进行登录页 授 ...

  8. 免费vpn

    http://www.freevpnmac.com/macvpn/ 下边有个滑动解锁,拖动鼠标至右边解锁,点击Get vpn info,得到vpn地址ip和用户密码. 我用安卓手机测试了下完全可以,但 ...

  9. html调用applet

    1.相同目录下 <applet code="*.class" width=250 height=50> </applet> 指定applet类名称,appl ...

  10. imageWithContentsOfFile读取全路径返回的image为空的解决方法

    下载图片缓存到本地沙盒里,发现用 imageWithContentsOfFile去读取的时候,40%左右的几率会读取为空. 查找资料和文档后找到解决方法 路径:当这次的时候是/var/mobile/C ...