使用Eclipse的AndroidSlidingUpPanel的问题 - 错误充气类 [英] Troubles with AndroidSlidingUpPanel with Eclipse - Error Inflating class
问题描述
我正在尝试使用
将其设置为主项目的依赖项:
所以,你最终会得到这样的东西:
然后,使用此测试xml(您的xml抛出一个至少需要两个孩子的错误):
<?xml version =1.0encoding =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_height =match_parent
android:gravity =bottom
sothree =4dp
sothree:umanoParallaxOffset =100dp
sothree:umanoDragView =@ + id / dragView
sothree:umanoOverlay =true
sothree:umanoScrollableView = @ + ID /列表>
<! - 主内容 - >
< 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>
<! - 滑动布局 - >
< LinearLayout
android:layout_width =match_parent
android:layout_height =match_parent
android:background =#ffffff
android:orientation =
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>
它的作品!
I'm trying to use the AndroidSlidingUpPanel library (in Eclipse) and I have this error:
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
This is my layout:
<?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>
I downloaded the entire project and imported "main" as library. Then I add this library to my project's java build path. I have the feeling that is a java build path problem. Any idea?
Thank you so much for reading me and take your time to do it.
I just got it working in Eclipse.
The important part is to get your library project created correctly and then link it up to your main project.
For the library project, I created a project.properties file, and also added the jar files for the RecyclerView library, the support v4 library, and nineoldandroids.
I also created a .classpath file in order to make it automatically put the java folder in the build path.
I uploaded the library project that I got working to github: https://github.com/dmnugent80/SlidingUpPanel-for-Eclipse/tree/master
Then, import the library project into your workspace:
Set it up as a dependency of the main project:
So, you end up with something like this:
Then, using this test xml (your xml threw an error about needing a minimum of two children):
<?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>
It works!
这篇关于使用Eclipse的AndroidSlidingUpPanel的问题 - 错误充气类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!