2014-04-15 1 views
0

일부 내용을 표시하는 데 SwipeListView을 사용했습니다. 나는 그것이 만졌을 때 내 Listview의 색깔이 검은 색이되고, 다른 행이 선택 될 때까지 원한다. 내가 어떻게 할 수 있니? 나는 다음을 시도했지만 도움이되지 못했다. 드로어 블/사진 list_selector 스크롤 목록보기 항목에스 와이프에서 Listview 행의 색상을 변경하고 다른 행이 선택 될 때까지 계속 유지 하시겠습니까?

<?xml version="1.0" encoding="utf-8"?> 
    <selector xmlns:android="http://schemas.android.com/apk/res/android"> 

<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="false"/> 
<item android:drawable="@drawable/list_item_bg_pressed" android:state_pressed="true"/> 
<item android:drawable="@drawable/list_item_bg_pressed" android:state_activated="true"/> 
<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="true" ></item> 

</selector> 

답변

0

(조회수) @

main.xml 


<com.fortysevendeg.swipelistview.SwipeListView 
     android:id="@+id/example_swipe_lv_list" 

     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     swipe:swipeFrontView="@+id/front" 
     swipe:swipeBackView="@+id/back" 
     android:background="?android:attr/activatedBackgroundIndicator" 
     android:listSelector="@drawable/list_selector" 
     android:choiceMode="singleChoice" 
     swipe:swipeDrawableChecked="@drawable/choice_selected" 
     swipe:swipeDrawableUnchecked="@drawable/choice_unselected" 
     swipe:swipeCloseAllItemsWhenMoveList="true" 

     swipe:swipeMode="both" 
     /> 

재사용된다. View의 기존 상태를 유지하려면 ViewHolder 개념을 사용해야합니다. 밖으로

확인 아래의 링크 :

http://developer.android.com/training/improving-layouts/smooth-scrolling.html

findViewById vs View Holder Pattern in ListView adapter

스토어 배열에서 선택한 항목을 선택합니다. 항목이 존재하는지 계속 확인하고 getView()에서 배경색을 변경하십시오.