Saturday, April 21, 2012

[android-developers] Cannot change the visiblity of an imageview

I have a listview using a custom cursoradapter to fill the listview.

The row.xml

<code>
<?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>
</code>

As you can see, the imageview's visibility is gone. I want to make it
visible for one particular row. here is the code i tried but not
working..

<code>
View view = getListView().getAdapter().getView(0, null, null);
ImageView iv =
(ImageView)view.findViewById(R.id.currentplaying);
iv.setVisibility(ImageView.VISIBLE);
</code>

Thanks in advance..

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate