2012-01-15 35 views
0

我無法打開正確的屏幕。 我有以下代碼,並且我還在清單中添加了相應的類。 請,如果你能給我一些想法。 謝謝。項目通過ListView Android不能正常工作

listV.setOnItemClickListener(new AdapterView.OnItemClickListener() { 

    public void onItemClick(AdapterView<?> parent, View arg1, int position, long arg3) { 
    ListAdapter adp = (ListAdapter)parent.getAdapter(); 

    //lista.get(position); 
    Seccion s = lista.get(Integer.parseInt(adp.getItem(position).toString())); 

    if (s.getTitle().contains("Estudiar")) { 
     //sel.setText("Seleccionado el del if"+ s.getTitle()); 
     Intent i = new Intent(LiverpoolguideActivity.this,tipoListado.class); 
     startActivity(i); 
    } 
    } 
}); 

代碼tipoListado.class:

package jorgechu.com.liverpoolguide; 

import java.util.ArrayList; 

import jorgechu.com.liverpoolguide.Secciones.Seccion; 
import android.app.Activity; 
import android.os.Bundle; 
import android.widget.TextView; 

public class tipoListado extends Activity { 

    public class LiverpoolguideActivity extends Activity { 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.listadotipo); 
    } 
    } 
} 

和代碼屏幕的xml:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
> 

    <TextView 
     android:id="@+id/textViewListadoTipo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Tipo:" 
     android:textStyle="bold" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     /> 

    <ListView 
     android:id="@+id/listViewType" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    </ListView> 

</LinearLayout> 
+1

將一些日誌記錄到您的代碼中,並幫助我們自助。它到底是什麼?物品是否點擊?它是否碰到了if?你有沒有崩潰?你的LogCat說什麼?來吧,你應該做所有這些,然後再發布堆棧溢出。 – Blundell 2012-01-15 21:59:25

回答

1

一個ListView項目內調焦意見將禁止選擇的ListView項目的能力。將android:focusable =「false」應用於TextView將允許OnItemClick再次運行。