技术标签: ListView ListView折叠 展开收起 android android listview 动态ListView
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ListView
android:id="@+id/pro_lv"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#F6F5F4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv_control"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:clickable="true"
android:padding="5dp"
android:text="展开更多"
android:textColor="#99000000"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_pro_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="11dp"
android:padding="5dp"
android:text="美妆专场"
android:textColor="#000000"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp" >
<ImageView
android:id="@+id/iv_produce"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:background="#e000BE93"
android:padding="5dp"
android:text="当前价:¥189"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#e000BE93"
android:padding="5dp"
android:text="¥899"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#e000BE93"
android:padding="5dp"
android:text="开始06-18 18:00"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#e000BE93"
android:text="02:00:18"
android:textSize="12sp" />
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv_prod_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:text="兰蔻最新季护肤套装"
android:textColor="#000000"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_baoming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:text="报名"
android:textColor="#1FDCAC"
android:textSize="14sp" />
</RelativeLayout>
<ListView
android:id="@+id/lv_more_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="0.0dip"
android:fadingEdge="none"
android:visibility="gone" >
</ListView>
<LinearLayout
android:id="@+id/ll_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#F6F5F4" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp" >
<ImageView
android:id="@+id/iv_more"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:background="#e000BE93"
android:padding="5dp"
android:text="当前价:¥1189"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#e000BE93"
android:padding="5dp"
android:text="¥899"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#e000BE93"
android:padding="5dp"
android:text="开始06-18 18:00"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:layout_margin="10dp"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#e000BE93"
android:text="02:00:18"
android:textSize="12sp" />
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv_more_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:text="兰蔻最新季护肤套装"
android:textColor="#000000"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_baoming"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:text="报名"
android:textColor="#1FDCAC"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
//填充数据
private List<Map<String, Object>> getData() {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();//Map集合填充数据
String exlist_adapter = "1234";
map.put("exlist_adapter", exlist_adapter);
map.put("zhuanchang", "美妆专场");
map.put("info", "兰蔻最新季护肤套装");
map.put("img", R.drawable.pro);
list.add(map);
final TextView tv_control = (TextView) convertView.findViewById(R.id.tv_control);
final TextView tv_baoming = (TextView) convertView.findViewById(R.id.tv_baoming);
//默认隐藏的ListView
final ListView listmore = (ListView) convertView
.findViewById(R.id.lv_more_list);//展开的布局
tv_control.setOnClickListener(new OnClickListener() {
boolean isOpened = false;//改变展开状态
@Override
public void onClick(View v) {
if (!isOpened) {
listmore.setVisibility(View.VISIBLE);
tv_control.setText("收起");
isOpened = true;
}else {
listmore.setVisibility(View.GONE);
tv_control.setText("展开更多");
isOpened = false;
}
}
});
tv_baoming.setOnClickListener(new OnClickListener() {
//报名按钮
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
final ListView listmore = (ListView) convertView
.findViewById(R.id.lv_more_list);
Madapter madapter = new Madapter(getApplicationContext());
listmore.setAdapter(madapter);
setListViewHeightBasedOnChildren(listmore);
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight
+ (listView.getDividerHeight() * (listAdapter.getCount() - 1));
((MarginLayoutParams) params).setMargins(10, 10, 10, 10); // 可删除
listView.setLayoutParams(params);
1、class 前为什么必须要有public ?public只是class的一种修饰词,表示公开的类,既所有的类都可引入使用2、类成员的访问控制权限
大唐双龙传 第八章 统一草原 两人钻入车厢,马车开行。 可达志笑道:“小弟不得不用此手段,皆因这里耳目众多,敌人的探子耳目若杂在街上行人里监视我们,神仙也难察觉。小弟将以种种方法,把跟踪者摆脱,认为绝对安全后...
简介遗传算法基于GA优化BP网络大脑图像分割基于GA优化BP神经网络矿井通风计算
2019独角兽企业重金招聘Python工程师标准>>> ...
最近做一个功能,当contentOffset改变后 会请求一个网络,当请求返回之后会刷新一下view的大小,然后就发现contentOffset不对了。这个问题查了好久,最后发现是因为我重置了scrollView的frame,即使两个frame是相同的,也会有这个问题。解决方法:先判断一个frame有没有改变if (!CGRectEqualToRect(scrollRect, _s
前几天一直在想着如何能用flask-user对flask-admin进行登录验证通过两天的实验达到了目标(由于资料参考比较少所以花的时间多了些)flask-user 将flask-login整合了进来 因此 实现方式与flask-login有点相识下面是我的代码from flask import Flask,url_forfrom flask_sqlalchemy i...
Ø AXIS_HOMED:/axis1_4Ø AXIS_LIB%AXIS_HOME%/libØ AXIS_CLASSPATHD:/axis1_4/lib/axis.jar;D:/axis1_4/lib/axis-ant.jar;D:/axis1_4/lib/commons-discovery-0.2.jar;D:/axis1_4/
通过$("#form").serialize()可以获取到序列化的表单值字符串。例如:a=1&b=2&c=3&d=4&e=5通过$("#form").serializeArray()输出以数组形式序列化表单值。[ {name: 'firstname', value: 'Hello'}, {name: 'lastname', value: 'World'}, {name:
排名函数是SQL Server2005新加的功能。在SQL Server2005中有如下四个排名函数: 1.row_number 2.rank 3.dense_rank 4.ntile 一、row_number row_number函数的用途是非常广泛,这个函数的功能是为查询出来的每一行记录生成一个序号。 其中row_
这里有个很尴尬的casehttps://github.com/qiniu/android-sdk/blob/5674a4ab5e983b359df91ca544f6b1a22d0423ff/library/src/main/java/com/qiniu/android/http/CountingRequestBody.java#L71ForwardingSink,实现了这个方法,okhttp内部的抽象方法。这个代码通过抛出异常的方式去中断/取消。从log信息看,这个位置应该是走到了throw new然
转载至:https://blog.csdn.net/niha1993825jian/article/details/41086403#include <stdio.h>#include <errno.h>#include <ctype.h>#include <string.h>#include <stdlib.h>#inc...
很不错的一篇TutorialUnderstanding Convolutional Neural Networks for NLP,把里面提及的论文整理了一下。Convolutional Neural Networks for Sentence Classification(ACL2014)感觉这应该是最早的一篇把CNN用于处理文本的论文,网络模型十分简单。模型直接在Word Vector...