2017-04-25 6 views
0

내가 작성한 사용자 정의 listview에 대한 "setOnItemClickListener"가 있습니다. 행을 클릭하면 메소드가 실행됩니다. 그거야. 나는사용자 정의 listview 내에서 textview에서 클릭 가능한 링크가 있고 클릭 가능한 listview가있는 방법

android:autoLink="web" 

...이를 사용하여 목록보기 내에서 텍스트 뷰에서 클릭 할 수있는 링크를 얻을 수 있어요 그러나 행이 unclickable된다. 링크가없는 행은 클릭 할 수 있습니다. autoLink가 listview의 "setOnItemClickListener"를 재정의합니다. 이 문제를 어떻게 극복 할 수 있습니까? 포커스 요소와

답변

1

ListView

추가 .. 자체가

을 극복하려면 ListView에 클릭 이벤트를 비활성화 :

android:descendantFocusability="blocksDescendants" 

귀하의 목록보기 행의 루트 레이아웃에

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:descendantFocusability="blocksDescendants" 
    android:orientation="vertical"> 


    <TextView 
     android:id="@+id/textview" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:autoLink="web" 
     android:focusable="false" 
     android:textSize="15sp" /> 
</LinearLayout> 
+0

링크가있는 경우 행을 클릭 할 수 없습니다. 그것. – Z10987654321X

+0

그게 효과가 있어요. 나는 네가 의미하는 바를 오해했다. 수정 및 설명 주셔서 감사합니다. – Z10987654321X

관련 문제