Проблемы с AndroidSlidingUpPanel с Eclipse - Ошибка раздувания класса

1

Я пытаюсь использовать библиотеку 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>

Я загрузил весь проект и импортировал "главную" в качестве библиотеки. Затем я добавляю эту библиотеку в свой путь сборки java проекта. У меня такое чувство, что проблема с построением java-сборки. Любая идея?

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

Теги:
slidingpanelayout

1 ответ

1
Лучший ответ

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

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

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

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

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

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

Изображение 174551

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

Изображение 174551

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

Изображение 174551

Затем, используя этот тест 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>

Это работает!

Изображение 174551

  • 1
    Я цитирую вам, и я очень рад сделать это: «Это работает!». Отличная работа, Даниэль. Огромное спасибо.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню