OnİtemCLickListener liste görünümü ANDROİD çalışmıyor | Netgez.com
SORU
5 NİSAN 2011, Salı


OnİtemCLickListener liste görünümü ANDROİD çalışmıyor

heres faaliyet sınıfı kodu

conversationList = (ListView)findViewById(android.R.id.list);
ConversationArrayAdapter conversationArrayAdapter=new  ConversationArrayAdapter(this, R.layout.conversation_list_item_format_left, conversationDetails);
conversationList.setAdapter(conversationArrayAdapter);
conversationList.setOnItemClickListener(new AdapterView.OnItemClickListener(){ 

    @Override
    public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
        Log.d("test","clicked");
    }
});

adaptör sınıftan getView fonksiyonu kod heres

if (v == null) {                                
    LayoutInflater vi = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if(leftSideMessageNumber.equals(m.getTo())) {
        v = vi.inflate(R.layout.conversation_list_item_format_left, null);
    } else {
        v = vi.inflate(R.layout.conversation_list_item_format_right, null);
    }
}

Yok şişirme sırasında 2 xmls kullanmak için bir sorun... bir yardım takdir tüm....

CEVAP
17 Ocak 2013, PERÅžEMBE


Ben sadece buradan çözüm.. ama derin tıklayarak belirledi

Eğer listedeki herhangi bir satır öğesi odaklanabilir veya tıklanabilir görüntüleyin varsa OnItemClickListener işe yaramaz.

Satır öğesi android:descendantFocusability="blocksDescendants" gibi bir param var.

burada listenize öğe gibi görünmelidir nasıl bir örnek görebilirsiniz. Liste başındaki xml olmalıdır... row_item.xml (your_xml_file.xml)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical" >

// your other widgets here

</LinearLayout>

Bunu PaylaÅŸ:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • boniver

    boniver

    17 NİSAN 2006
  • Electro Posé

    Electro PosÃ

    21 ÅžUBAT 2013
  • Unbox Therapy

    Unbox Therap

    21 Aralık 2010