ListView 包含textview 高度(行数不固定) 如何动态算listview的高度

15:52 提问
关于android中listview里面textview显示混乱
哪位大神能帮我解决下面代码中的listview里面textview的显示混乱问题 纠结好久了 谢谢 复制可以直接执行
package com.example.
import java.util.ArrayL
import android.os.B
import android.app.A
import android.view.LayoutI
import android.view.M
import android.view.V
import android.view.View.OnClickL
import android.view.ViewG
import android.widget.BaseA
import android.widget.ImageV
import android.widget.LinearL
import android.widget.ListV
import android.widget.NumberP
import android.widget.TextV
import android.widget.T
public class MainActivity extends Activity {
ArrayList&String& buf = new ArrayList&String&();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
list = (ListView)findViewById(R.id.listView1);
inflater = getLayoutInflater();
for (int i=0;i&100;i++)
buf.add(String.valueOf(i));
list.setAdapter(adapter);
BaseAdapter adapter = new BaseAdapter() {
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder viewH
if (convertView == null)
convertView = inflater.inflate(R.layout.item, null);
viewHolder = new ViewHolder();
viewHolder.line = (LinearLayout)convertView.findViewById(R.id.single_item);
convertView.setTag(viewHolder);
viewHolder = (ViewHolder)convertView.getTag();
TextView text = (TextView)viewHolder.line.getChildAt(1);
text.setText(buf.get(position) + "");
if (Integer.parseInt(buf.get(position)) % 5 == 0)
text.setTextColor(20);
viewHolder.line.setClickable(false);
viewHolder.line.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (Integer.parseInt(buf.get(position)) % 5 == 0)
Toast.makeText(MainActivity.this, "position==" + position, Toast.LENGTH_SHORT).show();
return convertV
public long getItemId(int position) {
// TODO Auto-generated method stub
public Object getItem(int position) {
// TODO Auto-generated method stub
public int getCount() {
// TODO Auto-generated method stub
return buf.size();
class ViewHolder
public LinearL
1.activity_main.xml
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" &
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" &
&/ListView&
2.item.xml
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android=""
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" &
&LinearLayout
android:id="@+id/single_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" &
&ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"/&
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:padding="15dp"
android:text="点我"
android:textColor="#003399"/&
&/LinearLayout&
按赞数排序
你适配器中的复用出现了问题 。
照你这么写
根本没复用到 。不符合逻辑
这涉及到listview里面的服用机制,其实gridview也是用这一套服用机制,如果你看过android源码就会知道,其实不管你怎么滑动,开启了服用机制,你的view就只有一套,这一套view大size就是你的屏幕可以现实view的数量,你往下往上滑都是服用之前用过的view,所以你在现实时候要做好判读有if就要有else这样是最保险的
180关注|827收录
1195关注|1139收录
2350关注|145收录
其他相似问题android,listView的一行我想放两个textView,第一个占尽量多的位置,怎么写?就是我每一行放俩textView,左右分布,第二个宽度是50sp,第一个(左边的那个)占剩下的所有空间.然后我放了一个线性layout上去,指定水平排列,然后给第一个textView加上android:weight="1",没效果.应该怎么写呢?
1.使用tablelayout,定义成两列,即每行显示两个textview,每列的宽度可以自定义.2.使用LinearLayout,即LinearLayout套LinearLayout ,外层采用垂直布局,每一行也需要一个LinearLayout ,定义成水平布局.3.使用gridview也能搞定.
1、效果很好。谢谢!
为您推荐:
扫描下载二维码求教ListView针对每一项可以动态布局
在listview的第一个item可以加载不同数量的图片和内容,类似qq空间里面的发表的图片说说,根据图片数量不同,界面显示就不同。
------解决方案--------------------
重写ListView的Adapter(可以继承BaseAdapter),重写getView方法,根据getView方法里面的position分别infater不同的布局
------解决方案--------------------
楼上讲的很好!你可以在geiView方法里生成linearlayout,根据需要往linearlayout添加控件,最后return&linearlayout控件
------解决方案--------------------
在geiView中加载不同的布局
------解决方案--------------------
有个函数&&getItemViewType(int&position)&;不错。
@Override&&&
public&intgetItemViewType(int&position)&{&&&
&&&&if&(DATA[pos].type&==&0)&{&&&
&&&&&&&&return&0;&&&
&&&&}&else&{&&&
&&&&&&&&return&1;&&&
@Override&&&
public&int&getViewTypeCount()&{&&&
&&&&return&2;&&&
@Override&&&
public&View&getView(int&position,&View&convertView,&ViewGroup&arg2)&{&&&
&&&&TitleViewHolder&titleH&&&
&&&&InfoViewHolder&infoH&&&
&&&&int&type&=&getItemViewType(position);&&&
&&&&if&(convertView&==&null)&{&&&
&&&&&&&&switch&(type)&{&&&
&&&&&&&&case&0:&&&
&&&&&&&&&&&&convertView&=&mInflater.inflate(R.layout.item_view,&null);&&&
&&&&&&&&&&&&titleHolder&=&new&TitleViewHolder();&&&
&&&&&&&&&&&&titleHolder.titleTextView&=&(TextView)&convertView.findViewById(R.id.text);&&&
&&&&&&&&&&&&titleHolder.iconImageView&=&(ImageView)&convertView.findViewById(R.id.icon);&&&
&&&&&&&&&&&&convertView.setTag(titleHolder);&&&
&&&&&&&&&&&&&&&
&&&&&&&&case&1:&&&
&&&&&&&&&&&&convertView&=&mInflater.inflate(R.layout.item_view2,&null);&&&
&&&&&&&&&&&&infoHolder&=&new&InfoViewHolder();&&&
&&&&&&&&&&&&infoHolder.titleTextView&=&(TextView)&convertView.findViewById(R.id.text);&&&
&&&&&&&&&&&&convertView.setTag(infoHolder);&&&
&&&&&&&&&&&&&&&
&&&&&&&&}&&&
&&&&}&else&{&&&
&&&&&&&&switch&(type)&{&&&
&&&&&&&&case&0:&&&
&&&&&&&&&&&&titleHolder&=&(TitleViewHolder)&convertView.getTag();&&&
&&&&&&&&&&&&&&&
&&&&&&&&case&1:&&&
&&&&&&&&&&&&infoHolder&=&(InfoViewHolder)&convertView.getTag();&&&
&&&&&&&&&&&&&&&
&&&&&&&&}&&&
&&&&switch&(type)&{&&&
&&&&case&0:&&&
&&&&&&&&titleHolder.titleTextView.setText(DATA[pos].title);&&&
&&&&&&&&&&&
&&&&case&1:&&&
&&&&&&&&infoHolder.titleTextView.setText(DATA[pos].title);&&&
&&&&&&&&infoHolder.iconImageView.setImageBitmap(DATA[pos].bitmap);&&&
&&&&&&&&&&&
&&&&return&convertV&&&
static&class&TitleViewHolder&{&&&
&&&&public&ImageView&iconImageV&&&
&&&&public&TextView&titleTextV&&&
如何在listview上点击复选框后得到每一项的值? 如何在listview上点击复选框后得到每一项的值?
------解决思路----------------------
holderView.check.setOnCheckedChangeListener(newOnCheckedChangeListener(){
@Override publicvo
能否把viewpager放在一个listview的第一项? 能否把viewpager放在一个listview的第一项?求demo,并且viewpager里面的页面能够自动切换页面,还有那个小圆点。。。
------解决方案-------------------- 哪有那么复杂,加一个headerview就好了
------解决方案-------------------- listv
Android expandablelistview 点击groupview的一项却展开另外一项 Androidexpandablelistview点击groupview的一项却展开另外一项,在4.2的操作系统上可以正确运行,但是在2.3.3的操作系统上就会出错。。。请问应该怎么办
------解决方案-------------------- 不能吧,我用的时候,怎么没遇
AdapterView.OnItemClickListener怎样获取点击那一项的内容 比如说,
一个ListView的每一行的第一列是日期,
能不能点击这一行,
就得到这一行第一列的日期?
------解决方案--------------------
publicvoidonItemClick(AdapterView&?&arg0,&nb
Listview 里面的checkbox怎么与数据库绑定 listview的adapter是simplecurdoradapter,是直接取出数据库中的值进行显示,里面的数据是可以动态添加的,listview的每一项都有一个checkbox控件,有什么办法在更改checkbox对象的时候更改数据库的值呢?
新人求教。。 publicclassMainActivityextendsActivity{
privateButtonbtn_main_left,btn_main_right,btn_contour_left,btn_contour_right,btn_line_left,
ListView中,如何在一个数组中添加两个item
服务器向传了一串数组,需要在ListView中展示,每一项数组都有两个需要展示的数据,比如1项数组中,有一个&起床&,然后添加到ListView中,还有一个&睡觉&,又要添加到listView中,Adapter中值能一项一项读取,然后添加一个item,如何添加两项item?
------解决思路---
Android的listView Android点击列表某一行第一次可以高亮显示,再点就不可以了,是怎么回事呢??
------解决方案-------------------- 代码呢?。。。
listview 动态添加 动态添加后会把原来的数据都变成最新数据,就是把原来的覆盖了,why?
初始第一次
动态添加后第一条数据也变成和第二条一样的了
Android使用ScrollView和自定义的ListView实现两列的ListView
1、为了实现两列的ListView,首先我们需要定义一个每一项的布局文件music_find_music_menu_item.xml
&?xml version=&1.0& encoding=&utf-8&?& &LinearLayout xml
请问如何在listview上动态显示或隐藏一个“删除”按钮 我在listview的布局xml文件中最后加了一个删除按钮,并将其visibility设置为&gone&,这样每一行最后的这个按钮是隐藏的。
但是我想让用户点击了界面上的一个“编辑”按钮后,listview每一行后面的“删除”按钮能够显示出来,请问怎么实现呢?
------解决思路-----------------
最近一项目,有点类似电视的画中画,已经完美解决,来送分
本帖最后由 miw__ 于
14:28:59 编辑
需求类似下图:
|-----------------------|
||-------------||-------||
layout.xml布局和模拟器显示严重不一致,该如何解决 xml中有4个Button,布局如下:
android:id=&@+id/AddData&
Listview内容动态改变后怎么重新执行layoutanimation呢 不知道是是不是方向错了...
ListView设置有简单的layoutanimation
启动Activity后Listview里面就一项Loading...
然后就是网络请求数据,然后将数据解析到adapter
然后notifyDataSetChanged
现在就是noti
Android Camera Parameters 方法出错,求教
publicclassPhotographActivityextendsBaseActivityimplements
SeekBar.OnSeekBarChangeListener,OnClickListener,Runnable&nbsp
点击ListView闪退
一点击ListVIew就闪退,调试了两天了,好痛苦,望大家解救。
这是部分日志
02-.207:E/InputEventReceiver(764):Exceptiondispatchinginputevent.
02-.207:&nbsp
话说大家对于switch语句应该再熟悉不过了,各种类C语言都不例外,JavaScript自然也是如此。switch的逻辑很简单,根据switch内容的值执行对应的case项,否则执行default项即可。但是不同的语言在具体一些细节上面的处理却是不同的。例如在JavaScript里,每个case项都可以没有break,于是语句便会顺延到下个case或是default里面去——但某些语言设计者认为这
求助:如何动态修改ListVIew中每个Item的值 通过Listview加载item做了一个类似于商店的东西,每次点击“BUY”button就更新一下价格,可是每个Item的价格Textview都共用一个ID,该怎么更新这个textview呢?(我已经通过用settag()和gettag()为每个button设置不同的响应。)
------解决方案-------------------- 这个
Android的动态调用 我想在安卓应用中实现动态调用,类似Windows调用动态连接库:
yyy=::LoadLibrary(xxxxx);
zzz=::GetProcAddress(yyyy,&aaaa&);
zzzz(...);
我需要开发该安卓应用,同时,也需要开发该库。
我百度了一下,感觉就是所
android中listView如何复用多种布局
android中listView如何复用多种布局
uinavigationcontroller 在rootcontroller里有一个tableview(有两项A和B),点击其中一项A打开新的view(也是一个tableview,里面有数据C和D)。然后点击navigationcontroller顶部的返回,然后再点击B,显示仍然是C和D。已确认点击B后数据已经更新了(应该是E和F),但界面上显示的仍然是A的数据(C和D)。
求教应该怎么做
实现复杂的滚动布局 跟scrollview和listview相关 新手求教,scrollview和listview不推荐嵌套,虽然可以嵌套,但是假如有一个布局立面又有图片文本或者其他组件,又有很多列表框,这种比较复杂的滚动布局如果只用其中一种或者有其他滚动布局能够实现这样的吗?
------解决思路---------------------- 一般,如果没法避开滚动布局嵌套,我会考虑让改UI设计
求教大神! 请问一下我在layout里面直接拉了CalendarView控件过啦用,结果在xml文件中报错提示说:ViewrequiresAPIlevel11(currentminis8):&CalendarView&请问大神是什么原因啊?图片点击可在新窗
ListView点击事件怎样获取点击项的ID或信息? 我临时用EclipseJava编写Android软件,语言不熟练
我在主界面main.xml和item页面item.xml中分别使用ListView和两个TextView显示,现在的问题是:
ViewPager里启动Activity 两层ViewPager,里层ViewPager里有一个ListView,想要实现点击一个item后启动activity.不知道有什么办法可以实现?
对布局不是特别熟悉,可能是布局的时候没考虑好,如果在不更改布局的前提下怎么实现这种功能?
下边是错误截图
------解决思路---------------------- 先说说怎么解决的啊
新手求助--ListView与Button无法共存 我想在一个Activity中实现一个按钮A,A按钮下方是一个ListView
问题是ListView里面的每一项都有一个按钮A,但我在XML中就放了一个Button,而且ListView行高设置不知道怎么写。
1.能不能告诉我Xml中应该改什么?
2.ListView行高设置代码在java文件中怎么写?
以下是我的JAVA文件
Android中改变ListView的某几行的颜色 Android中ListView中的数据是动态加载出来的。
根据需求,加载出来的数据中需要用颜色区分出来比较特殊的数据。
也就是需要改变某几行的颜色(字体或背景,最好是字体)。
该怎么实现呢?求助!!
------解决方案-------------------- 在adapter的getview中设置背景颜色就可以了
------解决方
新手求教 请问在windows下虚拟机上开发iphone会不会很卡,电脑4g内存,双核cpu。另外还有虚拟机上可不可以用真机调试?
------解决方案-------------------- 会很卡,可以调试,不可发布
------解决方案-------------------- 我开始用的虚拟机,很卡,后来没办法买了一台MAC的笔记本。 建议楼主要开发还是要在真机上,速度快些。
在android settings.db数据库中添加一项新的设置
Settings数据存放在com.android.providers.settings/databases/settings.db 中 数据库中数据的默认数据在frameworks/base/packages/SettingsProvider/res/values/defaults.xml中定义,如果要在数据库中添加一个新的字段,
ListView中不显示HeaderView ListView中加了头和尾后不显示HeaderView。当ListView高度为精确值时(dp)没问题。但当为match_parent和wrap_content时就只能看到尾了,看不到头(头成是空白了),请各位帮忙看一下。
activity_main.xml:
&LinearLayoutxmlns:android=&h
在listview中动态改变ProgressBar的进度,求大侠解答!
//以下是自定义适配器的的代码...
publicclassListView_AdapterextendsBaseAdapter{
privateList&Singl
关于listview,求帮助。
这种该怎么用ListView实现。并且可以按照输入数量实现加载相应多的条目。
------解决思路---------------------- 每一个item都是一个布局,可以从xml加载,然后根据数量就是for循环,在adapter的getview中加载item,配合viewholder
新手求问、 这种UI布局应该怎么实现。
------解决思路----------------------
Quote: 引用:
ListView,然后自定义listView的item布局
可是我需要对日期设置点击事件选择日期,然后日期会更新为选择日期啊。
点击的时候就弹出一个日期选择对话框,然后将选择的日期写入item。
------解决思路------------
IOS旋转布局 本人刚刚接触IOS开发,今天试了一个小例子:想把 这个效果变成 但是结果却一直这样
请问各位大神怎么解决啊?
我的是IOSSDK6.0
下边是ViewController.m代码
#import&ViewController.h&
@interfaceViewController()
Android中怎样实现动态添加一行EditView 类似于联系人app中添加联系人号码的功能,可以按+后添加一栏EditView,增加一个号码,或是按按钮后增加修改联系人姓名(增加前缀后缀)的EditView。
------解决思路---------------------- 用ListView就可以啊,用addView方法,想搞好看一个就建好xml模板,使用View.inflate(模板在R
android应用面试宝典;footerview自动添加在下翻页的最后一项;主界面返回键退出提示
全局类 package com.kane.interviewcollection.
import com.kane.interviewcollection.dbc.SqliteC import android.app.A public class Gl
怎么让listview无法选中,listview中的button可以被选中 就是类似于QQ中聊天界面的哪种效果,listview的item没有选中效果,但是item中的textview可以被选中,这个怎么实现??
求助。。。
------解决思路---------------------- 在布局文件中设置listviewandroid:listselector=&qu
求教推送通知的概念! 假设推送通知的内容是“您的车被偷了”,如果这个应用程序正在运行(而不是关闭了),那么这个通知该如何处理(包括服务器端和客户端)?
如果能提供学习资料就更好了~~~
希望大神给指一条路。
------解决方案-------------------- 应用在前台运行时在这里处理推送消息
-(void)application:(UIApplication&n
在线性布局中动态添加view 我想在线性布局中添加一个textview在线性布局中的一个控件左边~~求大神帮忙~~
------解决方案-------------------- LienarLayoutly=newLinearLayout(getApplicationContext());
ly.setsetOrientation(L
listview divider 无意间看到如图:
问:这里的divider长度如何设置?
是因为图片height的设置会覆盖的么?
------解决方案-------------------- 不会的,你在listview的属性中,就有一条是设置listview的divider的,和listview一样宽
------解决方案-------------------- 那就在listv查看: 1285|回复: 15
scrollview中如何动态的固定listview的高度.
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
在scrollview中嵌套了一个listview,listview中的item高度是动态的.
现在是需要在点击右边的checkbox的时候,listview的高度能够动态的设置.
这段代码我用过,没有效果.
希望有给个DEMO实际计算的,而不是单纯的去网上复制粘贴发过来的.
问题解决了的金币随便追加(1000以内)
附件: 您需要
才可以下载或查看,没有帐号?
代码不完整,我不好整合,如果方便你可以发源代码给我,不方便的话就自己一步一步调试,看哪里出问题了
签到天数: 175 天连续签到: 1 天[LV.7]常住居民III主题帖子e币
你的DEMO是OK的,唯一就是你一开始初始化的时候没有给设置一次(首次进入是显示14个),点击checkbox之后就正 ...
代码不完整,我不好整合,如果方便你可以发源代码给我,不方便的话就自己一步一步调试,看哪里出问题了
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
/**
& && && &* 动态设置ListView组建的高度
& && && &*/
& && &&&public static void setListViewHeightBasedOnChildren(ListView listView,Adapter adapter) {
& && && && && & Adapter listAdapter = (Adapter) listView.getAdapter();
& && && && && & if (listAdapter == null) {
& && && && && && && && &
& && && && && & }
& && && && && & 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()));
& && && && && & listView.setLayoutParams(params);
& && &&&}复制代码
这段代码用过.没有效果
使用这段代码是完全没问题的,前提是布局文件上没有设置Pading,如果有设置要添加设置的这部分高度上去&
签到天数: 175 天连续签到: 1 天[LV.7]常住居民III主题帖子e币
本帖最后由 完美之时空 于
14:24 编辑
这段代码用过.没有效果
使用这段代码是完全没问题的,前提是布局文件上没有设置Pading,如果有设置要添加设置的这部分高度上去,还有点击CheckBox之后,记得添加adapter.notifyDataSetChanged();
如下图所示,文字的textview属性带有padding属性,其次在item的外层父类布局文件中没有设置padding属性.
最后可以确定的是.
如果没有点击chekcbox的高度是100,点击之后item的高度为300.
同时在点击之后也有notifydata.&
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
使用这段代码是完全没问题的,前提是布局文件上没有设置Pading,如果有设置要添加设置的这部分高度上去,还有 ...
如下图所示,文字的textview属性带有padding属性,其次在item的外层父类布局文件中没有设置padding属性.
最后可以确定的是.
如果没有点击chekcbox的高度是100,点击之后item的高度为300.
同时在点击之后也有notifydata.&&但是就是没有效果. 希望能做个DEMO处理.
贴item布局文件的代码:
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
& & xmlns:app=&/tools&
& & android:layout_width=&match_parent&
& & android:layout_height=&wrap_content&
& & android:descendantFocusability=&blocksDescendants&
& & android:background=&@color/por_bg&
& & android:orientation=&vertical& &
& & &RelativeLayout
& && &&&android:layout_width=&match_parent&
& && &&&android:layout_height=&@dimen/item_height&&
& && &&&&LinearLayout
& && && && &android:layout_width=&wrap_content&
& && && && &android:layout_height=&@dimen/item_height&
& && && && &android:layout_marginLeft=&10dip&
& && && && &android:orientation=&vertical& &
& && && && &
& && && && &&TextView
& && && && && & android:id=&@+id/tv_name&
& && && && && & android:layout_marginTop=&11dip&
& && && && && & android:layout_width=&fill_parent&
& && && && && & android:layout_height=&@dimen/item_stock_name_hei&
& && && && && & android:gravity=&center_vertical&
& && && && && & android:singleLine=&true&
& && && && && & android:text=&阿里巴巴&
& && && && && & android:textColor=&@color/white&
& && && && && & android:textSize=&@dimen/item_stock_name& /&
& && && && &&TextView
& && && && && & android:id=&@+id/tv_code&
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&@dimen/item_stock_code_hei&
& && && && && & android:gravity=&center_vertical&
& && && && && & android:singleLine=&true&
& && && && && & android:text=&233232&
& && && && && &&&android:layout_marginTop=&@dimen/item_stock_name_code_margin&
& && && && && & android:textColor=&@color/item_stock_code&
& && && && && & android:textSize=&@dimen/item_stock_code& /&
& && &&&&/LinearLayout&
& && &&&&LinearLayout
& && && && &android:layout_width=&wrap_content&
& && && && &android:layout_height=&match_parent&
& && && && &android:layout_centerInParent=&true&
& && && && &android:orientation=&horizontal& &
& && && && &&TextView
& && && && && & android:id=&@+id/tv_price&
& && && && && & android:layout_width=&60dip&
& && && && && & android:layout_height=&match_parent&
& && && && && & android:gravity=&center_vertical|right&
& && && && && & android:singleLine=&true&
& && && && && & android:text=&7.62&
& && && && && & android:textColor=&@color/white&
& && && && && & android:textSize=&@dimen/item_stock_price& /&
& && && && &&LinearLayout
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&match_parent&
& && && && && & android:gravity=&center_vertical& &
& && && && && & &TextView
& && && && && && &&&android:id=&@+id/tv_rate&
& && && && && && &&&android:layout_width=&80dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:layout_margin=&10dip&
& && && && && && &&&android:gravity=&center&
& && && && && && &&&android:singleLine=&true&
& && && && && && &&&android:textSize=&@dimen/item_stock_rate& /&
& && && && &&/LinearLayout&
& && &&&&/LinearLayout&
& && &&&&CheckBox
& && && && &android:id=&@+id/cb&
& && && && &android:layout_width=&50dip&
& && && && &android:layout_height=&match_parent&
& && && && &android:layout_alignParentRight=&true&
& && && && &android:drawableLeft=&@drawable/right_gray&
& && && && &android:button=&@null&
& && && && &android:gravity=&center&
& && && && &android:paddingLeft=&20dip&
& && && && &android:paddingRight=&5dip& /&
& & &/RelativeLayout&
& & &LinearLayout
& && &&&android:id=&@+id/ll_fenxi&
& && &&&android:layout_width=&match_parent&
& && &&&android:layout_height=&wrap_content&
& && &&&android:visibility=&gone&
& && &&&android:orientation=&vertical& &
& && &&&&LinearLayout
& && && && &android:id=&@+id/ll_fenxi1&
& && && && &android:layout_width=&match_parent&
& && && && &android:layout_height=&@dimen/item_height&
& && && && &android:background=&@color/por_bg&
& && && && &android:orientation=&horizontal& &
& && && && &&TextView
& && && && && & android:layout_width=&16dip&
& && && && && & android:layout_height=&48dip&
& && && && && & android:layout_marginLeft=&10dip&
& && && && && & android:layout_marginTop=&5dip&
& && && && && & android:background=&@color/por_nomal&
& && && && && & android:ems=&1&
& && && && && & android:paddingLeft=&2dip&
& && && && && & android:paddingRight=&2dip&
& && && && && & android:singleLine=&false&
& && && && && & android:text=&量化分析&
& && && && && & android:textColor=&@color/white&
& && && && && & android:textSize=&10sp& /&
& && && && &&LinearLayout
& && && && && & android:layout_width=&match_parent&
& && && && && & android:layout_height=&match_parent&
& && && && && & android:layout_marginLeft=&5dip&
& && && && && & android:layout_marginRight=&10dip&
& && && && && & android:layout_marginTop=&5dip&
& && && && && & android:background=&@color/por_nomal&
& && && && && & android:orientation=&horizontal& &
& && && && && & &RelativeLayout
& && && && && && &&&android:layout_width=&0dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:layout_marginLeft=&20dip&
& && && && && && &&&android:layout_marginTop=&5dip&
& && && && && && &&&android:layout_weight=&1& &
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_dangqianqushi&
& && && && && && && && &android:layout_width=&50dip&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&当前趋势&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && && &&&&ImageView
& && && && && && && && &android:id=&@+id/iv_lianghua_qushi&
& && && && && && && && &android:layout_width=&15dip&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:layout_toRightOf=&@+id/tv_dangqianqushi&
& && && && && && && && &android:scaleType=&centerInside&
& && && && && && && && &android:src=&@drawable/top_jiantou& /&
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_yaliwei&
& && && && && && && && &android:layout_width=&wrap_content&
& && && && && && && && &android:layout_height=&wrap_content&
& && && && && && && && &android:layout_below=&@+id/tv_dangqianqushi&
& && && && && && && && &android:layout_marginTop=&10dip&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&压力位:&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && & &/RelativeLayout&
& && && && && & &LinearLayout
& && && && && && &&&android:layout_width=&0dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:layout_weight=&1&
& && && && && && &&&android:orientation=&vertical& &
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_zhidi&
& && && && && && && && &android:layout_width=&match_parent&
& && && && && && && && &android:layout_height=&0dip&
& && && && && && && && &android:layout_weight=&1&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&公司质地:&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_zhichengwei&
& && && && && && && && &android:layout_width=&match_parent&
& && && && && && && && &android:layout_height=&0dip&
& && && && && && && && &android:layout_weight=&1&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&支撑位:&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && & &/LinearLayout&
& && && && &&/LinearLayout&
& && &&&&/LinearLayout&
& && &&&&LinearLayout
& && && && &android:id=&@+id/ll_xinhao&
& && && && &android:layout_width=&match_parent&
& && && && &android:layout_height=&@dimen/item_height&
& && && && &android:background=&@color/por_bg&
& && && && &android:orientation=&horizontal& &
& && && && &&TextView
& && && && && & android:layout_width=&16dip&
& && && && && & android:layout_height=&48dip&
& && && && && & android:layout_marginLeft=&10dip&
& && && && && & android:layout_marginTop=&5dip&
& && && && && & android:background=&@color/por_nomal&
& && && && && & android:ems=&1&
& && && && && & android:paddingLeft=&2dip&
& && && && && & android:paddingRight=&2dip&
& && && && && & android:singleLine=&false&
& && && && && & android:text=&买卖信号&
& && && && && & android:textColor=&@color/white&
& && && && && & android:textSize=&10sp& /&
& && && && &&LinearLayout
& && && && && &&&android:id=&@+id/ll_none&
& && && && && & android:layout_width=&0dip&
& && && && && & android:layout_height=&48dip&
& && && && && & android:layout_marginLeft=&5dip&
& && && && && & android:layout_marginRight=&10dip&
& && && && && & android:layout_marginTop=&5dip&
& && && && && & android:layout_weight=&2&
& && && && && & android:background=&@color/por_nomal&
& && && && && & android:orientation=&horizontal&
& && && && && & android:visibility=&gone& &
& && && && && &
& && && && && & &TextView
& && && && && && && && &android:layout_width=&match_parent&
& && && && && && && && &android:layout_height=&match_parent&
& && && && && && && && &android:gravity=&center&
& && && && && && && && &android:singleLine=&false&
& && && && && && && && &android:ems=&17&
& && && && && && && && &android:text=&暂无策略,无法提供买卖信号,点击此处,前往添加.&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && &&/LinearLayout&
& && && && &&LinearLayout
& && && && && & android:layout_width=&0dip&
& && && && && & android:layout_height=&48dip&
& && && && && & android:layout_marginLeft=&5dip&
& && && && && & android:layout_marginRight=&10dip&
& && && && && & android:layout_marginTop=&5dip&
& && && && && & android:layout_weight=&2&
& && && && && & android:id=&@+id/ll_have&
& && && && && & android:background=&@color/por_nomal&
& && && && && & android:orientation=&horizontal& &
& && && && && & &RelativeLayout
& && && && && && &&&android:id=&@+id/rl_left&
& && && && && && &&&android:layout_width=&20dip&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&ImageView
& && && && && && && && &android:layout_width=&15dip&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:layout_centerInParent=&true&
& && && && && && && && &android:scaleType=&centerInside&
& && && && && && && && &android:src=&@drawable/back_left& /&
& && && && && & &/RelativeLayout&
& && && && && & &LinearLayout
& && && && && && &&&android:layout_width=&0dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:layout_weight=&1&
& && && && && && &&&android:orientation=&vertical& &
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_celue_name&
& && && && && && && && &android:layout_width=&match_parent&
& && && && && && && && &android:layout_height=&0dip&
& && && && && && && && &android:layout_weight=&1&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_shouyilv&
& && && && && && && && &android:layout_width=&match_parent&
& && && && && && && && &android:layout_height=&0dip&
& && && && && && && && &android:layout_weight=&1&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&周收益率:&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && & &/LinearLayout&
& && && && && & &RelativeLayout
& && && && && && &&&android:layout_width=&0dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:layout_marginLeft=&20dip&
& && && && && && &&&android:layout_marginTop=&5dip&
& && && && && && &&&android:layout_weight=&1& &
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_zhoupaiming&
& && && && && && && && &android:layout_width=&wrap_content&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&周排名 :&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && && &&&&ImageView
& && && && && && && && &android:id=&@+id/iv_xinhao_qushi&
& && && && && && && && &android:layout_width=&15dip&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:layout_toRightOf=&@+id/tv_zhoupaiming&
& && && && && && && && &android:scaleType=&centerInside&
& && && && && && && && &android:src=&@drawable/top_jiantou& /&
& && && && && && &&&&TextView
& && && && && && && && &android:id=&@+id/tv_zhunque&
& && && && && && && && &android:layout_width=&wrap_content&
& && && && && && && && &android:layout_height=&wrap_content&
& && && && && && && && &android:layout_below=&@+id/iv_xinhao_qushi&
& && && && && && && && &android:layout_marginTop=&10dip&
& && && && && && && && &android:gravity=&center_vertical&
& && && && && && && && &android:singleLine=&true&
& && && && && && && && &android:text=&周准确率:&
& && && && && && && && &android:textColor=&@color/white&
& && && && && && && && &android:textSize=&12sp& /&
& && && && && & &/RelativeLayout&
& && && && && & &TextView
& && && && && && &&&android:id=&@+id/tv_jianyi&
& && && && && && &&&android:layout_width=&50dip&
& && && && && && &&&android:layout_height=&match_parent&
& && && && && && &&&android:gravity=&center_vertical&
& && && && && && &&&android:singleLine=&true&
& && && && && && &&&android:textColor=&@color/white&
& && && && && && &&&android:textSize=&16sp&
& && && && && && &&&android:textStyle=&bold& /&
& && && && && & &RelativeLayout
& && && && && && &&&android:id=&@+id/rl_right&
& && && && && && &&&android:layout_width=&20dip&
& && && && && && &&&android:layout_height=&match_parent& &
& && && && && && &&&&ImageView
& && && && && && && && &android:layout_width=&15dip&
& && && && && && && && &android:layout_height=&15dip&
& && && && && && && && &android:layout_centerInParent=&true&
& && && && && && && && &android:scaleType=&centerInside&
& && && && && && && && &android:src=&@drawable/back_right& /&
& && && && && & &/RelativeLayout&
& && && && &&/LinearLayout&
& && &&&&/LinearLayout&
& & &/LinearLayout&
&/LinearLayout&复制代码
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
附件中有图片.
本帖子中包含更多资源
才可以下载或查看,没有帐号?
签到天数: 4 天连续签到: 1 天[LV.2]偶尔看看I主题帖子e币
还没解决这个问题么= =
如果您有思路的话,建议可以写个简单的DEMO测试,我这试过,但是没找到方法,&
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
还没解决这个问题么= =
如果您有思路的话,建议可以写个简单的DEMO测试,我这试过,但是没找到方法,
签到天数: 175 天连续签到: 1 天[LV.7]常住居民III主题帖子e币
本帖最后由 完美之时空 于
16:56 编辑
刚写的一个小demo,希望能对你有帮助
本帖子中包含更多资源
才可以下载或查看,没有帐号?
我看了你的DEMO.
我尝试把你的String的个数改为40.
然后测试,发现不起效果.
而且下面会有多出一屏白的页面.
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
刚写的一个小demo,希望能对你有帮助
谢谢.&&我试试看
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
刚写的一个小demo,希望能对你有帮助
我看了你的DEMO.& &&&我尝试把你的String的个数改为40.&&然后测试,发现不起效果.&&而且下面会有多出一屏白的页面.&&你试试看
没问题啊 我再传一次吧,加注释了&
签到天数: 175 天连续签到: 1 天[LV.7]常住居民III主题帖子e币
我看了你的DEMO.& &&&我尝试把你的String的个数改为40.&&然后测试,发现不起效果.&&而且下面会有多出一屏 ...
没问题啊 我再传一次吧,加注释了
本帖子中包含更多资源
才可以下载或查看,没有帐号?
你的DEMO是OK的,唯一就是你一开始初始化的时候没有给设置一次(首次进入是显示14个),点击checkbox之后就正常了.
我参考你的DEMO,把项目中修改了,其他地方和你的写法和配置一样.
唯独就是adapter中内容不一样,&
我正测试.&
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
没问题啊 我再传一次吧,加注释了
very&&thanyou& &我正测试.
签到天数: 50 天连续签到: 1 天[LV.5]常住居民I主题帖子e币
没问题啊 我再传一次吧,加注释了
你的DEMO是OK的,唯一就是你一开始初始化的时候没有给设置一次(首次进入是显示14个),点击checkbox之后就正常了.& &
我参考你的DEMO,把项目中修改了,其他地方和你的写法和配置一样.&&
唯独就是adapter中内容不一样,但是我参考你的算法,高度是算对的,但是界面不显示隐藏的区域.
package com.aft.stockweather.ui.
import java.util.L
import android.annotation.SuppressL
import android.content.C
import android.graphics.C
import android.os.H
import android.view.LayoutI
import android.view.V
import android.view.View.OnClickL
import android.view.ViewG
import android.widget.BaseA
import android.widget.B
import android.widget.CheckB
import poundB
import poundButton.OnCheckedChangeL
import android.widget.LinearL
import android.widget.TextV
import com.aft.stockweather.R;
import com.aft.stockweather.constant.C
import com.aft.stockweather.model.Q
import com.aft.stockweather.model.StockS
import com.aft.stockweather.model.StrategyResultVO;
import com.aft.stockweather.ui.fragment.portfolio.PortfolioFragmentV11;
import com.aft.monU
* 自选股列表V11
* @Title: PortfolioAdapterV11.java
* @Package com.jdy.stockweather.ui.adapter
* @Description: TODO()
* @author JALEN&&& &
* @date 日 上午9:56:58
* [url=home.php?mod=space&uid=85817]@version[/url] V1.0
*/
public class PortfolioAdapterV11 extends BaseAdapter {
& & & & private&&Context mC
& & & & public List&StockSelf& VOs;
& & & & private H
& & & & private int select=0;//当前选中的元素
& & & & public int checkedSize=0;
//& & & & public Map&Integer,Boolean&
& & & & private int num=0;
& & & & @SuppressLint(&UseSparseArrays&)
& & & & public PortfolioAdapterV11(Context context, List&StockSelf& VOs,Handler handler) {
& & & & & & & & mContext =
& & & & & & & & this.VOs = VOs;
& & & & & & & & this.handler=
//& & & & & & & & this.map=
& & & & }
& & & & @Override
& & & & public int getCount() {
& & & & & & & & return VOs.size();
& & & & }
& & & & @Override
& & & & public Object getItem(int position) {
& & & & & & & & return VOs.get(position);
& & & & }
& & & & @Override
& & & & public long getItemId(int position) {
& & & & & & & &
& & & & }
& & & & @SuppressLint(&ViewHolder&)
& & & & @Override
& & & & public View getView(final int position, View convertView, ViewGroup parent) {
& & & & & & & & final LinearLayout&&layout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.list_item_portfoliov11, null);
& & & & & & & & final TextView tv_name = (TextView) layout.findViewById(R.id.tv_name);
& & & & & & & & final TextView tv_code = (TextView) layout.findViewById(R.id.tv_code);
& & & & & & & & final TextView tv_rate = (TextView) layout.findViewById(R.id.tv_rate);
& & & & & & & & final TextView tv_price = (TextView) layout.findViewById(R.id.tv_price);
& & & & & & & & final TextView tv_dangqianqushi = (TextView) layout.findViewById(R.id.tv_dangqianqushi);
& & & & & & & & final CheckBox cb = (CheckBox) layout.findViewById(R.id.cb);
& & & & & & & &
& & & & & & & &
& & & & & & & & final LinearLayout ll_fenxi = (LinearLayout) layout.findViewById(R.id.ll_fenxi);
& & & & & & & & final LinearLayout ll_fenxi1 = (LinearLayout) layout.findViewById(R.id.ll_fenxi1);
& & & & & & & & final LinearLayout ll_xinhao = (LinearLayout) layout.findViewById(R.id.ll_xinhao);
& & & & & & & &
& & & & & & & & final LinearLayout ll_none = (LinearLayout) layout.findViewById(R.id.ll_none);
& & & & & & & & final LinearLayout ll_have = (LinearLayout) layout.findViewById(R.id.ll_have);
& & & & & & & & /**量化分析**/
& & & & & & & & final TextView tv_yaliwei = (TextView) layout.findViewById(R.id.tv_yaliwei);
& & & & & & & & final TextView tv_zhidi = (TextView) layout.findViewById(R.id.tv_zhidi);
& & & & & & & & final TextView tv_zhichengwei = (TextView) layout.findViewById(R.id.tv_zhichengwei);
//& & & & & & & & final ImageView iv_lianghua_qushi = (ImageView) layout.findViewById(R.id.iv_lianghua_qushi);
& & & & & & & & /**买卖信号**/
//& & & & & & & & final RelativeLayout rl_left = (RelativeLayout) layout.findViewById(R.id.rl_left);
//& & & & & & & & final RelativeLayout rl_right = (RelativeLayout) layout.findViewById(R.id.rl_right);
& & & & & & & & final TextView tv_celue_name = (TextView) layout.findViewById(R.id.tv_celue_name);
& & & & & & & & final TextView tv_shouyilv = (TextView) layout.findViewById(R.id.tv_shouyilv);
& & & & & & & & final TextView tv_zhoupaiming = (TextView) layout.findViewById(R.id.tv_zhoupaiming);
& & & & & & & & final TextView tv_zhunque = (TextView) layout.findViewById(R.id.tv_zhunque);
& & & & & & & & final TextView tv_jianyi = (TextView) layout.findViewById(R.id.tv_jianyi);
& & & & & & & & final Button btn_add = (Button) layout.findViewById(R.id.btn_add);
//& & & & & & & & final ImageView iv_xinhao_qushi = (ImageView) layout.findViewById(R.id.iv_xinhao_qushi);
& & & & & & & &
& & & & & & & &
& & & & & & & & final StockSelf cv = VOs.get(position);
& & & & & & & & final List&StrategyResultVO& svos = cv.getsResult();
& & & & & & & & try {
& & & & & & & & & & & & tv_name.setText(cv.getStocksName());
& & & & & & & & & & & & tv_code.setText(cv.getStockCode());
& & & & & & & & & & & &
& & & & & & & & & & & & if(cv.getRate()!=null){
& & & & & & & & & & & & & & & & if(cv.getRate().contains(&-&)){
& & & & & & & & & & & & & & & & & & & & tv_rate.setText(cv.getRate() );
& & & & & & & & & & & & & & & & & & & & tv_rate.setTextColor(Constant.CANDLER_GREEN);
& & & & & & & & & & & & & & & & }else{
& & & & & & & & & & & & & & & & & & & & if(cv.getRate().contains(&0.00&)){//停牌
& & & & & & & & & & & & & & & & & & & & & & & & tv_rate.setText(&停牌&);
& & & & & & & & & & & & & & & & & & & & & & & & tv_rate.setTextColor(Color.GRAY);
& & & & & & & & & & & & & & & & & & & & }else{
& & & & & & & & & & & & & & & & & & & & & & & & tv_rate.setText(cv.getRate() == null ? && :&+&+ cv.getRate());
& & & & & & & & & & & & & & & & & & & & & & & & tv_rate.setTextColor(Constant.CANDLER_RED);
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & & & & & tv_price.setText(cv.getPrice() == null ? && : cv.getPrice());
& & & & & & & & & & & &
& & & & & & & & & & & & Quantization quantization = cv.getQuantization();
& & & & & & & & & & & & if(quantization!=null){
& & & & & & & & & & & & & & & & if(quantization.getPressure()!=null)tv_yaliwei.setText(quantization.getPressure()+&元&);
& & & & & & & & & & & & & & & & if(quantization.getQuality()!=null)tv_zhidi.setText(&公司质地:&+quantization.getQuality());
& & & & & & & & & & & & & & & & if(quantization.getTrend()!=null)tv_dangqianqushi.setText(&当前趋势:&+quantization.getTrend());
& & & & & & & & & & & & & & & & if(quantization.getSustain()!=null)tv_zhichengwei.setText(quantization.getSustain()+&元&);
& & & & & & & & & & & & & & & & //趋势...
& & & & & & & & & & & & }
& & & & & & & & & & & & if(svos!=null&&svos.size()&0){
& & & & & & & & & & & & & & & & StrategyResultVO vo = svos.get(select);
& & & & & & & & & & & & & & & & tv_celue_name.setText(vo.getStyName());
& & & & & & & & & & & & & & & & tv_jianyi.setText(vo.getPointAdvice());
& & & & & & & & & & & & & & & & if(vo.getItem()!=null){
& & & & & & & & & & & & & & & & & & & & if(vo.getItem().equals(&week&)){
& & & & & & & & & & & & & & & & & & & & & & & & tv_shouyilv.setText(&周收益率:&+CommonUtil.formatDoublePerZero(vo.getYRWeek()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhunque.setText(&周准确率:&+CommonUtil.formatDoublePerZero(vo.getSRWeek()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhoupaiming.setText(&周排名:&+(vo.getRYRWeek()==null?&&:vo.getRYRWeek()));
& & & & & & & & & & & & & & & & & & & & }else if(vo.getItem().equals(&month&)){
& & & & & & & & & & & & & & & & & & & & & & & & tv_shouyilv.setText(&月收益率:&+CommonUtil.formatDoublePerZero(vo.getYRMonth()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhunque.setText(&月准确率:&+CommonUtil.formatDoublePerZero(vo.getSRMonth()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhoupaiming.setText(&月排名:&+(vo.getRYRMonth()==null?&&:vo.getRYRMonth()));
& & & & & & & & & & & & & & & & & & & & }else if(vo.getItem().equals(&quarter&)){
& & & & & & & & & & & & & & & & & & & & & & & & tv_shouyilv.setText(&季收益率:&+CommonUtil.formatDoublePerZero(vo.getYRQuarter()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhunque.setText(&季准确率:&+CommonUtil.formatDoublePerZero(vo.getSRQuarter()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhoupaiming.setText(&季排名:&+(vo.getRYRQuarter()==null?&&:vo.getRYRQuarter()));
& & & & & & & & & & & & & & & & & & & & }else if(vo.getItem().equals(&half&)){
& & & & & & & & & & & & & & & & & & & & & & & & tv_shouyilv.setText(&半年收益率:&+CommonUtil.formatDoublePerZero(vo.getYRHalf()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhunque.setText(&半年准确率:&+CommonUtil.formatDoublePerZero(vo.getSRHalf()));
& & & & & & & & & & & & & & & & & & & & & & & & tv_zhoupaiming.setText(&半年排名:&+(vo.getRYRHalf()==null?&&:vo.getRYRHalf()));
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & } catch (Exception e) {
& & & & & & & & & & & & e.printStackTrace();
& & & & & & & & }
& & & & & & & &
& & & & & & & & cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
& & & & & & & & & & & &
& & & & & & & & & & & & @Override
& & & & & & & & & & & & public void onCheckedChanged(CompoundButton buttonView,
& & & & & & & & & & & & & & & & & & & & boolean isChecked) {
& & & & & & & & & & & & & & & & if (isChecked) {//隐藏的区域就是ll_fenxi&&高度为114DP
& & & & & & & & & & & & & & & & & & & & num++;
& & & & & & & & & & & & & & & & & & & & // 隐藏View的高度(我设置为了60DP)如果有加内边距或外边距,要将高度加上去(我这里没有设置,所以就60dp的高度)
& & & & & & & & & & & & & & & & & & & & if(svos!=null&&svos.size()&0){
& & & & & & & & & & & & & & & & & & & & & & & & ll_none.setVisibility(View.GONE);
& & & & & & & & & & & & & & & & & & & & & & & & ll_have.setVisibility(View.VISIBLE);
& & & & & & & & & & & & & & & & & & & & }else{
& & & & & & & & & & & & & & & & & & & & & & & & ll_have.setVisibility(View.GONE);
& & & & & & & & & & & & & & & & & & & & & & & & ll_none.setVisibility(View.VISIBLE);
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & & & & & ll_fenxi.setVisibility(View.VISIBLE);
& & & & & & & & & & & & & & & & & & & & hight = CommonUtil.dip2px(mContext, 114);
& & & & & & & & & & & & & & & & & & & & PortfolioFragmentV11.Updata(hight, num);
& & & & & & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & & & & & num--;
& & & & & & & & & & & & & & & & & & & & ll_fenxi.setVisibility(View.GONE);
& & & & & & & & & & & & & & & & & & & & PortfolioFragmentV11.Updata(hight, num);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & });
& & & &
& & & & & & & & ll_fenxi1.setOnClickListener(new OnClickListener() {
& & & & & & & & & & & & @Override
& & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & handler.sendMessage(handler.obtainMessage(1, position));
& & & & & & & & & & & & }
& & & & & & & & });
& & & & & & & & ll_have.setOnClickListener(new OnClickListener() {
& & & & & & & & & & & &
& & & & & & & & & & & & @Override
& & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & handler.sendMessage(handler.obtainMessage(2, position));
& & & & & & & & & & & & }
& & & & & & & & });
& & & & & & & & btn_add.setOnClickListener(new OnClickListener() {
& & & & & & & & & & & &
& & & & & & & & & & & & @Override
& & & & & & & & & & & & public void onClick(View v) {
& & & & & & & & & & & & & & & & handler.sendMessage(handler.obtainMessage(3, position));
& & & & & & & & & & & & }
& & & & & & & & });
//& & & & & & & & layout.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
& & & & & & & &
& & & & }
& & & & public List&StockSelf& getVOs() {
& & & & & & & & return VOs;
& & & & }
& & & & public int getCheckedSize() {
& & & & & & & & return checkedS
& & & & }
}
复制代码
代码不完整,我不好整合,如果方便你可以发源代码给我,不方便的话就自己一步一步调试,看哪里出问题了&
代码没问题,应该是你布局文件那里出问题了.使用这个计算高度,ListView的item布局一定要为LinearLayout&
签到天数: 175 天连续签到: 1 天[LV.7]常住居民III主题帖子e币
本帖最后由 完美之时空 于
22:47 编辑
你的DEMO是OK的,唯一就是你一开始初始化的时候没有给设置一次(首次进入是显示14个),点击checkbox之后就正 ...
我明天有空再看看
圣诞限量勋章
圣诞限量勋章
QQ已认证,此人靠谱
社区认证会员
社区认证会员
推荐阅读热门话题
619921850415415376321273264257254249234224215715
25&分钟前昨天&23:56昨天&21:48昨天&18:13昨天&18:09昨天&17:13昨天&16:02昨天&16:02昨天&15:36昨天&14:53昨天&14:40昨天&14:38昨天&14:15昨天&13:58昨天&13:40昨天&13:29
Powered by}

我要回帖

更多关于 ios 计算textview高度 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信