Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid how to access customized listview item
    primarykey
    data
    text
    <p>i tryied to custom my ListView , so i use this item layout 「 list_item.xml」</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" &gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/title" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:padding="10dp" android:textSize="16dip" android:textColor="#000000" android:gravity="center_vertical" android:background="#FFFFFF" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_weight="1"&gt; &lt;/TextView&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="0" android:background="#FFFFFF" android:padding="10dip" android:gravity="center_vertical"&gt; &lt;ImageView android:id="@+id/pause" android:src="@drawable/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="pauseBtn_onClick" /&gt; &lt;ImageView android:id="@+id/play" android:src="@drawable/play" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="playBtn_onClick"/&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>just as what you saw, there are 2 images in this layout, what i wanna do is,</p> <p>when user click any item , the play_icon(the second image in the listview item) , will </p> <p>disappear.</p> <p>so i write code as the following :</p> <pre><code>mp3_listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View _view, int index , long arg3) { String _url = musicList.get(index).get("link").toString(); LinearLayout _container = (LinearLayout)mp3_listView.getChildAt(index); RelativeLayout _container2 = (RelativeLayout) _container.getChildAt(1); ImageView img = (ImageView)_container2.getChildAt(1); img.setVisibility(View.INVISIBLE); Toast.makeText(tabDigTest.this , "GG : "+_container.findViewById(R.id.play) , Toast.LENGTH_SHORT).show(); } } </code></pre> <p>but something strange occurred .... more than one item's img be hidden because of the:</p> <pre><code>img.setVisibility(View.INVISIBLE); </code></pre> <p>i don't why because i only set one img to INVISIBLE ......i think i need help O_o</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload