2013-12-20 4 views
-1

사용자 지정 콘텐츠가있는 목록보기가 있습니다. 나는 메시지 iamgeview, 1 개의 외침 및 다른 선택권에있다. 사용자는 옵션 중 하나를 선택할 수 있지만 사용자가 텍스트 (텍스트보기를 터치) 또는 ListView의 다른 부분을 선택하면 응답하지 않아야합니다. 작은 UI가 있습니다.목록 항목을 선택 취소 할 수있게 만들기

사용자가 MyText를 터치하면 아무 것도 수행하지 않아도됩니다. 안드로이드에서 list tiem을 정상적으로 터치 할 때 비주얼을 피드백하지 않습니다. 하지만 전화를 걸거나 메시지가 나타나야합니다.

내 코드

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/listitem_contact" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" 
    android:padding="10dp"> 
    <TextView 
     android:id="@+id/tv_contact" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:clickable="false" 
     android:gravity="left|center_vertical"/> 
    <ImageView 
     android:id="@+id/iv_call" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:background="@drawable/list_item_image_color" 
     android:src="@drawable/ic_call"/> 
    <ImageView 
     android:id="@+id/iv_message" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:background="@drawable/list_item_image_color" 
     android:src="@drawable/ic_textmessage"/> 
    <ImageView 
     android:id="@+id/ic_phone" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:background="@drawable/list_item_image_color" 
     android:src="@drawable/ic_phone"/> 
</LinearLayout> 

PS : 첫 번째 기본 이미지 뷰에 의해 텍스트 뷰의 부분을 건드리지에 선택지고 있습니다. 터치하지 않으면 어떤 wodget도 반응하지 않기를 바랄 것입니다.

+0

u가있는 이미지보기에 작업을 지정하고 목록보기에 대한 작업을 수행하지 않으려면 onitem을 클릭하십시오. 그러면 텍스트보기를 선택하면 아무 것도하지 않겠습니다 –

+0

"textview의 부분을 만지면 기본적으로 ImageView가 시작됩니다 선택한 ". 어떻게 가능합니까? –

답변

0

항목을 터치 한 시각적 피드백은 ListView의 스타일입니다. 다음과 같이 변경할 수 있습니다.

<ListView 
android:listSelector="@android:color/transparent" 
android:cacheColorHint="@android:color/transparent" 
/> 

그러나보기에는 define your own styles and apply them이 가장 좋습니다.

관련 문제