2012-10-12 2 views
0

지난 며칠간이 문제를 해결하려고했지만 성공하지 못했습니다. 이미 사용할 수있는 많은 솔루션을 통과했지만 비 작동 중입니다. 고객 목록보기 및 사용자 정의 행이 있습니다. 간단한 커서 어댑터를 사용하여 목록보기를 채 웁니다. 내 사용자 정의 행에는 3 개의 이미지보기와 하나의 텍스트보기가 있습니다. 보기 중 하나는 클릭 할 수있는 팝업 창을 열고 행은 다음 조각으로 이동합니다. 내 문제는 클릭 할 수있는 이미지가 전체 행을 선택할 때까지 응답하지 않는다는 것입니다. 행을 선택하면 클릭 할 수있게됩니다.사용자 지정 목록보기 포커스 문제 android

 <ImageView 
     android:id="@+id/iv_LvRow_speedmap_PIcon" 
     android:layout_width="0dip" 
     android:layout_height="50dip" 
     android:layout_weight="0.20" 
     android:contentDescription="@string/todo" 
     android:paddingLeft="10dip" 
     android:src="@drawable/arrow4" /> 

    <TextView 
     android:id="@+id/tv_LVRow_SpeedMap_PDesc" 
     android:layout_width="0dip" 
     android:layout_height="50dip" 
     android:layout_weight="0.60" 
     android:ellipsize="none" 
     android:gravity="center_vertical|center_horizontal" 
     android:scrollHorizontally="true" 
     android:singleLine="true" 
     android:text="@string/textview" 
     android:textColor="@color/black" 
     android:textSize="14sp" /> 

     <ImageView 
      android:id="@+id/ib_LvRow_SpeedMap_InfoIcon" 
      android:layout_width="0dip" 
      android:layout_height="50dip" 
      android:layout_weight="0.10" 
      android:clickable="true" 
      android:contentDescription="@string/todo" 
      android:duplicateParentState="false" 
      android:focusable="false" 
      android:focusableInTouchMode="false" 
      android:src="@drawable/info_icon" /> 

    <ImageView 
     android:id="@+id/imgView_ArrowImg_speedMap" 
     android:layout_width="0dip" 
     android:layout_height="50dip" 
     android:layout_weight="0.10" 
     android:contentDescription="@string/todo" 
     android:src="@drawable/arrow4" /> 
</LinearLayout> 

ListView lv = getListView(); 
    // lv.setItemsCanFocus(true); 
    // lv.setClickable(true); 
    // lv.setFocusable(true); 
     lv.setOnItemClickListener(new OnItemClickListener() { 

      @Override 
      public void onItemClick(AdapterView<?> arg0, View v, int arg2, 
        long arg3) { 

       final String where = "id = " + Long.toString(arg3); 
       ImageView iv = (ImageView) v 
         .findViewById(R.id.ib_LvRow_SpeedMap_InfoIcon); 
       // iv.setClickable(true); 
       // iv.setFocusable(true); 
       iv.setOnClickListener(new OnClickListener() { 

        @Override 
        public void onClick(View v) { 
         System.out.println("id2"); 
         String[] projection = { "name", "description" }; 
         String selection = where; 
         Cursor cursor = null; 
         cursor = getActivity().getContentResolver().query(
           DatabaseContentProvider.CONTENT_URI_CONCERNS, 
           projection, selection, null, null); 
         cursor.moveToFirst(); 
         if (cursor.getCount() > 0) { 
          String name = cursor.getString(cursor 
            .getColumnIndex("name")); 

          System.out.println("name" + name); 
          String description = cursor.getString(cursor 
            .getColumnIndex("description")); 
          System.out.println("description" + description); 
          info(name, description, v); 

         } 

        } 
       }); 

      } 
     }); 

답변

관련 문제