我希望listview中的可点击单词用于此我使用可点击的跨度但不起作用 请帮帮我
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
TextView ocTextTitle =(TextView)ocHolder.txtTitle;
if ( ocTextType.getText().equals("d") )
{
if ( isOnline.equals("1") )
{
Intent intent = new Intent ( ChildList.this, loginTwo.class );
intent.putExtra ( "TextBox",ocTextTitle.getText().toString() );
startActivity(intent);
}
}
答案 0 :(得分:1)
如果您对listview使用自定义适配器,请在getView方法中尝试以下一个。
String title = ocHolder.ocTextType.getText();
holder.TV_userLevel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (title != null && title.equals("d") )
{
if ( isOnline.equals("1") )
{
Intent intent = new Intent ( mContext, loginTwo.class );
intent.putExtra ( "TextBox",title);
startActivity(intent);
}
}
}
});