Android 的listview问题 Android 的listview中使用一个布局文件中的不同textview时,当有的行的textview visiable属性设置为gone时会导致另外的行出现问题,怀疑是重用导致的,不知道有没有好的解决办法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是重用的问题。你自己写一个adapter,重写getView,在里面先调用父类的getView,然后对返回的这个View做一些gone或者反向操作。 public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub if (convertView == null) { convertView = mInflater.inflate(R.layout.listview, null); } if (contents.get(position).getTopic) { TextView topic = (TextView) convertView.findViewById(R.id.title); topic.setText(contents.get(position).getName()); TextView admin = (TextView) convertView.findViewById(R.id.admin); admin.setVisibility(View.GONE); } else { TextView admin = (TextView) convertView.findViewById(R.id.admin); admin.setText(contents.get(position).getAdmin()); TextView topic = (TextView) convertView.findViewById(R.id.title); topic.setText(contents.get(position).getName()); } return convertView; }基本上是这样写的,找不出原因 else{TextView admin = (TextView) convertView.findViewById(R.id.admin);admin.setText(contents.get(position).getAdmin());//这里加一句,让控件显示出来,就是和View.GONE相反的,叫什么我忘记了。TextView topic = (TextView) convertView.findViewById(R.id.title);topic.setText(contents.get(position).getName());} admin.setVisibility(View.VISIBLE);谢啦 这个listView是重用的,好像会屏幕下边滚上来的一个如果不设置的话默认是采用刚刚滚出的一个布局 不能自动写入R.java 解压dex文件出了好多问题 项目中导包后出现的问题。。。。 求救:关于ShareSDK微信分享 java程序如何hook? eclipse 导入带有C++的android项目。 穿线测试理念介绍 1.0版 怎么保存Android端的用户登录状态 求教:发短信时,我没有指定自己的手机号码,但是收短信会显示,为什么 请问登录界面的问题 android 交叉编译问题 如何发出提醒通知?
你自己写一个adapter,重写getView,在里面先调用父类的getView,然后对返回的这个View做一些gone或者反向操作。
{
// TODO Auto-generated method stub
if (convertView == null)
{
convertView = mInflater.inflate(R.layout.listview, null);
}
if (contents.get(position).getTopic)
{
TextView topic = (TextView) convertView.findViewById(R.id.title);
topic.setText(contents.get(position).getName());
TextView admin = (TextView) convertView.findViewById(R.id.admin);
admin.setVisibility(View.GONE);
}
else
{
TextView admin = (TextView) convertView.findViewById(R.id.admin);
admin.setText(contents.get(position).getAdmin());
TextView topic = (TextView) convertView.findViewById(R.id.title);
topic.setText(contents.get(position).getName());
} return convertView; }
基本上是这样写的,找不出原因
{
TextView admin = (TextView) convertView.findViewById(R.id.admin);
admin.setText(contents.get(position).getAdmin());
//这里加一句,让控件显示出来,就是和View.GONE相反的,叫什么我忘记了。
TextView topic = (TextView) convertView.findViewById(R.id.title);
topic.setText(contents.get(position).getName());
}