У меня есть ListView с настраиваемым адаптером списка (который расширяет BaseAdapter). Вид элементов моего списка раздувается из этого макета:
<?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="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center_vertical"
>
<TextView
android:id="@+id/txtOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
/>
<TextView
android:id="@+id/txtTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
В методе getView представление элементов создается и заполняется:
if (convertView == null) {
convertView = inflater.inflate(R.layout.teste, parent, false);
}
((TextView) convertView.findViewById(R.id.txtOne)).setText("Some text");
final SpannableString ss = new SpannableString("Another text");
ss.setSpan(new ClickableSpan() {
@Override
public void onClick(final View widget) {
startActivity(new Intent(widget.getContext(), AnotherActivity.class));
}
}, 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
((TextView) convertView.findViewById(R.id.txtTwo)).setText(ss);
Он показывает мою связующую строку на виде предмета, но я не могу ее коснуться. Я могу касаться только всего элемента.
Я хочу начать другое занятие, когда пользователь касается настраиваемой строки, но я также хочу, чтобы весь вид элемента был доступен.
Чего мне не хватает?