Проблемы с AndroidSlidingUpPanel с Eclipse — ошибка при надувании класса

Я пытаюсь использовать библиотеку AndroidSlidingUpPanel (в Eclipse) и получаю следующую ошибку:

04-19 20:09:48.413: E/AndroidRuntime(13760): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mendozatourapp/com.mendozatourapp.activitys.MapsActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.sothree.slidinguppanel.library.SlidingUpPanelLayout

Это мой макет:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DemoActivity" >

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        xmlns:sothree="http://schemas.android.com/apk/lib/res-auto"
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        sothree:panelHeight="68dp"
        sothree:shadowHeight="4dp"
        sothree:paralaxOffset="100dp"
        sothree:dragView="@+id/name">  
   </com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>

Я скачал весь проект и импортировал main как библиотеку. Затем я добавляю эту библиотеку в путь сборки java моего проекта. У меня такое ощущение, что это проблема пути сборки Java. Есть идеи?

Большое спасибо за то, что читаете меня и не торопитесь, чтобы сделать это.


person flagg327    schedule 19.04.2016    source источник
comment
Вам нужно превратить его в проект библиотеки для Eclipse. Вы добавили в библиотеку файл project.properties и файл AndroidManifest.xml?   -  person Daniel Nugent    schedule 20.04.2016
comment
Да я сделал это. Спасибо.   -  person flagg327    schedule 20.04.2016


Ответы (1)


Я только что заработал в Eclipse.

Важно правильно создать проект библиотеки, а затем связать его с основным проектом.

Для проекта библиотеки я создал файл project.properties, а также добавил jar-файлы для библиотеки RecyclerView, библиотеки поддержки v4 и nineoldandroids.

Я также создал файл .classpath, чтобы он автоматически помещал папку java в путь сборки.

Я загрузил проект библиотеки, над которым работал, на github: https://github.com/dmnugent80/SlidingUpPanel-for-Eclipse/tree/master

Затем импортируйте проект библиотеки в свою рабочую область:

введите здесь описание изображения

Настройте его как зависимость основного проекта:

введите здесь описание изображения

Итак, у вас получится что-то вроде этого:

введите здесь описание изображения

Затем, используя этот тестовый xml (ваш xml выдал ошибку о необходимости как минимум двух дочерних элементов):

<?xml version="1.0" encoding="utf-8"?>
<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoPanelHeight="68dp"
    sothree:umanoShadowHeight="4dp"
    sothree:umanoParallaxOffset="100dp"
    sothree:umanoDragView="@+id/dragView"
    sothree:umanoOverlay="true"
    sothree:umanoScrollableView="@+id/list">

    <!-- MAIN CONTENT -->
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:id="@+id/main"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="30dp"
            android:gravity="center"
            android:text="Main Content"
            android:clickable="true"
            android:focusable="false"
            android:focusableInTouchMode="true"
            android:textSize="16sp" />
    </FrameLayout>

    <!-- SLIDING LAYOUT -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        android:orientation="vertical"
        android:clickable="true"
        android:focusable="false"
        android:id="@+id/dragView">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="68dp"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/name"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:textSize="14sp"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"/>

            <Button
                android:id="@+id/follow"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:textSize="14sp"
                android:gravity="center_vertical|right"
                android:paddingRight="10dp"
                android:paddingLeft="10dp"/>

        </LinearLayout>

        <ListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">
        </ListView>
    </LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

Оно работает!

введите здесь описание изображения

person Daniel Nugent    schedule 20.04.2016
comment
Я цитирую вам, и я очень рад сделать это: Это работает!. Отличная работа Даниил. Большое спасибо. - person flagg327; 20.04.2016