2013-04-15 2 views
2

У меня та же проблема, что данный пользователь: the other questionандроид swipelist отсутствующих атрибуты

Но у меня есть имя класса в моем файле XML макета правильно типизированный и в XML просмотр не дает какую-либо ошибки, но когда я перехожу к графическому макету, я получаю сообщение об ошибке:

java.lang.RuntimeException: You forgot the attributes swipeFrontView or swipeBackView. 
You can add this attributes or use 'swipelist_frontview' and 'swipelist_backview'  
identifiers 

Я добавил девять мерседесов и баннеры для салфетки.

Любые советы по этому вопросу?

ответ

0

Вам нужно в вас список что-то вроде этого:

<?xml version="1.0" encoding="utf-8"?> 
<com.fortysevendeg.android.swipelistview.SwipeListView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:swipe="http://schemas.android.com/apk/res-auto" 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:listSelector="#00000000" 
    swipe:swipeActionLeft="dismiss" 
    swipe:swipeBackView="@+id/back" 
    swipe:swipeCloseAllItemsWhenMoveList="true" 
    swipe:swipeFrontView="@+id/front" 
    swipe:swipeMode="both" /> 
2

Изменение идентификаторов в SwipeListView к

swipe:swipeBackView="@+id/swipelist_backview" 
swipe:swipeFrontView="@+id/swipelist_frontview" 

А в представлении элемента списка

<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <RelativeLayout 
     android:id="@+id/swipelist_backview" 
     ...> 
     ... 
    </RelativeLayout> 

    <RelativeLayout 
     android:id="@+id/swipelist_frontview" 
     ...> 
     ... 
    </RelativeLayout> 

    </FrameLayout> 

Решил проблему для меня. Я думаю, что эта ошибка как-то связана с этим тянуть запрос https://github.com/47deg/android-swipelistview/pull/11

2

swipeListView имеет 2 представления как "FrontView" & "Backview" попробовать этот пример XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

<RelativeLayout 
     android:id="@+id/back" 
     style="@style/ListBackContent" 
     android:layout_width="wrap_content" 
     android:layout_height="110dp" 
     android:tag="back" > 

    <LinearLayout 
      android:id="@+id/backshowportion" 
      style="@style/ListBackContent" 
      android:layout_width="250dp" 
      android:layout_height="110dp" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true"   
      android:gravity="right|center" > 

      <TextView 
        .... /> 

      <TextView 
        .... /> 

      <TextView 
         ..../> 
    </LinearLayout> 

</RelativeLayout> 

<RelativeLayout 
     android:id="@+id/front" 
     style="@style/ListFrontContent" 
     android:layout_width="match_parent" 
     android:layout_height="110dp" 
     android:orientation="vertical" 
     android:tag="front" > 
     <TextView 
       .... /> 

     <TextView 
       .... /> 

     <TextView 
       .... /> 

</RelativeLayout> 

</FrameLayout> 
Смежные вопросы