Android如何在一个线性布局里完美显示两个listview啊?
复写一个listView ,在你布局文件中使用此view:
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/size_30_dp"
- android:fadingEdge="none" >
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginLeft="@dimen/size_12_dp"
- android:text="@string/text_task_personal"
- android:textColor="@color/text_task_personal_color"
- android:textSize="@dimen/size_16" />
- <com.xxx.view.MyListView
- android:id="@+id/gtask_listview_doing"
- style="@style/inventory_view_list_style"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/detail_top"
- android:background="@color/white" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginLeft="@dimen/size_12_dp"
- android:text="@string/text_task_team"
- android:textColor="@color/text_task_team_color"
- android:textSize="@dimen/size_16" />
- <com.xxx.view.MyListView
- android:id="@+id/gtask_listview_finished"
- style="@style/inventory_view_list_style"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/detail_top"
- android:background="@color/white" />
- </LinearLayout>
- </ScrollView>
java代码:
- package com.xxx.view;
- import android.content.Context;
- import android.widget.ListView;
- public class MyListView extends ListView {
- public MyListView(Context context) {
- super(context);
- }
- public MyListView(Context context, android.util.AttributeSet attrs) {
- super(context, attrs);
- }
- public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE>> , MeasureSpec.AT_MOST);
- super.onMeasure(widthMeasureSpec, expandSpec);
- }
- }
Android如何在一个线性布局里完美显示两个listview啊?的更多相关文章
- Android 自学之线性布局 LinearLayout
线性布局(LinearLayout),线性布局有点想AWT编程里面的FolwLayout,他们都会将容器里面的组件挨个的排列起来. 他们最大的区别在于:Android的线性布局不会换行:AWT里面的F ...
- Android开发之线性布局详解(布局权重)
布局权重 线性布局支持给个别的子视图设定权重,通过android:layout_weight属性.就一个视图在屏幕上占多大的空间而言,这个属性给其设 定了一个重要的值.一个大的权重值,允许它扩大到填充 ...
- .Net程序猿玩转Android开发---(6)线性布局LinearLayout
LinearLayout控件是Android中重要的布局控件,是一个线性控件,所谓线性控件的意思是指该控件里面的内容仅仅能水平或垂直排列.也就 ...
- android 59 LinearLayout 线性布局
##常见的布局* LinearLayout 线性布局线性布局往左右拉是拉不动的,> 线性布局的朝向 vertical|horizontal> 线性布局的权重 weight 和 0dip一起 ...
- android学习之线性布局
效图如下 移通152余继彪 该布局使用了线性布局完成 父布局为线性布局,黄色和灰色部分为水平的线性布局,剩余50%部分为水平线性布局,该布局中包含了两个垂直的线性布局分别占了三分之1和三分之二
- Android之Linearlayouy线性布局
写了个小例子xml代码如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout x ...
- Android之LinearLayout线性布局
1.相关术语解释 orientation 子控件的排列方式,horizontal(水平)和vertical(垂直默认)两种方式! gravity 子控件的对齐方式,多个组合 layout_gravit ...
- Android开发:在布局里移动ImageView控件
在做一个app时碰到需要移动一个图案的位置,查了一上午资料都没找到demo,自己写一个吧 RelativeLayout.LayoutParams lp = new RelativeLayout.Lay ...
- Android——学习:线性布局权重分配
LinearLayout在Android中被广泛使用,LinearLayout有一个比较重要的属性——android:layout_weight.按照字面理解就是该控件的权重,这个值默认是 零(0). ...
随机推荐
- Asp.net上传出现“超过了最大请求长度”的问题解决方法
在开发ASP.NET网站后台管理系统时,我们可能会遇到这样的问题:上传大于4M的文件时,会提示错误:错误信息如下: 1.异常详细信息:超过了最大请求长度. 2.引发异常的方法:Byte[] GetEn ...
- js 获取当前时间格式怎么转换?
toLocaleDateString() 得到的时间是 yyyy年MM月dd日 HH:ss:mm 格式的,怎么转换成yyyy-MM-dd HH:ss:mm 在js里面 仅针对这个问题来说,不需要那么大 ...
- 用 C# 如何判断数据库中是否存在一个值
选定一个列,比如用户编号列 //欲插入的用户编号string ll_userID="xxxxxxxx"; //查询此编号是否存在SqlCommand mycmd = new Sql ...
- import com.sun.image.codec.jpeg.JPEGCodec不通过 Eclipse找不到包
Eclipse默认把这些受访问限制的API设成了ERROR.只要把Windows-Preferences-Java-Complicer-Errors/Warnings里面的Deprecated and ...
- android开发者博客二月Android Studio2.0测试
参考网页-http://android-developers.blogspot.com/2016/02/android-studio-20-beta.html Android Studio 2.0-B ...
- Android Activity的生命周期详解
应用程序中,一个Activity通常就是一个单独的屏幕,它上面可以显示一些控件也可以监听并处理用户的事件做出响应. Activity之间通过Intent进行通信.在Intent 的描述结构中,有两个最 ...
- MVC小系列(五)【在过滤器里引入重定向】
在过滤器里引入重定向 过滤器的引入:如果用户进行一个操作,但没有登录,可以在Post方法上加个过滤器以验证用户是否登录,如果登录成功,则继续进行操作,如果没有登录,则实现Url的重定向,进行登录页 授 ...
- 免费vpn
http://www.freevpnmac.com/macvpn/ 下边有个滑动解锁,拖动鼠标至右边解锁,点击Get vpn info,得到vpn地址ip和用户密码. 我用安卓手机测试了下完全可以,但 ...
- html调用applet
1.相同目录下 <applet code="*.class" width=250 height=50> </applet> 指定applet类名称,appl ...
- imageWithContentsOfFile读取全路径返回的image为空的解决方法
下载图片缓存到本地沙盒里,发现用 imageWithContentsOfFile去读取的时候,40%左右的几率会读取为空. 查找资料和文档后找到解决方法 路径:当这次的时候是/var/mobile/C ...