
row.xml
<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="horizontal" > <linearLayout androID:orIEntation="vertical" androID:layout_wIDth="0dip" androID:layout_weight="1" androID:layout_height="fill_parent"> <TextVIEw androID:ID="@+ID/Title" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:singleline="true" androID:gravity="center_vertical" androID:ellipsize="marquee" androID:textSize="24dp" /> <TextVIEw androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:ID="@+ID/artist" androID:singleline="true" androID:ellipsize="marquee" androID:textSize="14dp" /> </linearLayout> <ImageVIEw androID:ID="@+ID/currentplaying" androID:layout_wIDth="wrap_content" androID:layout_height="fill_parent" androID:layout_marginleft="1dip" androID:src="@androID:drawable/ic_media_play" androID:contentDescription="@string/Now_playing" androID:visibility="gone" /></linearLayout>
如您所见,ImageVIEw的可见性消失了.我想成功
对于一个特定行可见.这是我尝试的代码,但事实并非如此
工作…
VIEw vIEw = getListVIEw().getAdapter().getVIEw(0,null,null);ImageVIEw iv = (ImageVIEw)vIEw.findVIEwByID(R.ID.currentplaying);iv.setVisibility(ImageVIEw.VISIBLE);
提前致谢.
@OverrIDepublic VIEw getVIEw(int position,VIEw convertVIEw,VIEwGroup parent) { VIEwHolder holder; if(convertVIEw==null) { holder = new VIEwHolder(); convertVIEw = inflater.inflate(R.layout.yourlayout,null); holder.imgVIEwlogo = (ImageVIEw) convertVIEw.findVIEwByID(R.ID.imgVIEwlogo); convertVIEw.setTag(holder); } else { holder=(VIEwHolder)convertVIEw.getTag(); } if(position==0) { holder.imgVIEwlogo.setVisiblity(VIEw.VISIBLE); } return convertVIEw;} 编辑:
我搞定了.我用它来启动ListVIEw活动.
intent.putExtra("ID",c.getInt(c.getColumnIndex(DatabaseHelper._ID)));startActivity(intent); 在ListVIEw活动中,
currentplayingID = getIntent().getExtras().getInt("ID"); 然后我在bindvIEw()中添加了这个
ImageVIEw imgvIEw = (ImageVIEw)vIEw.findVIEwByID(R.ID.currentplaying);int ID = c.getInt(c.getColumnIndex(DatabaseHelper._ID));if (ID == SongsListActivity.this.currentplayingID) imgvIEw.setVisibility(VIEw.VISIBLE);else imgvIEw.setVisibility(VIEw.GONE);解决方法 我搞定了.我用它来启动列表视图活动.
intent.putExtra("ID",c.getInt(c.getColumnIndex(DatabaseHelper._ID)));startActivity(intent); 在ListvIEw活动中,
currentplayingID = getIntent().getExtras().getInt("ID"); 然后我在bindvIEw()中添加了这个
ImageVIEw imgvIEw = (ImageVIEw)vIEw.findVIEwByID(R.ID.currentplaying);int ID = c.getInt(c.getColumnIndex(DatabaseHelper._ID));if ( ID == SongsListActivity.this.currentplayingID )imgvIEw.setVisibility(VIEw.VISIBLE);elseimgvIEw.setVisibility(VIEw.GONE);总结
以上是内存溢出为你收集整理的android – 无法更改ImageView的可见性全部内容,希望文章能够帮你解决android – 无法更改ImageView的可见性所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)