1

Im trying to use the SlidingPanel library by Umano. While the DemoApp compiles and runs fine. It doesnt render the XML.

Here's the exception that the XML displays while rendering: http://pastebin.com/TZ2iSydg

activity_demo.xml

   <RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DemoActivity" >

    <com.sothree.slidinguppanel.demo.SlidingUpPanelLayout
        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:dragView="@+id/name"
        sothree:panelHeight="68dp"
        sothree:paralaxOffset="100dp"
        sothree:shadowHeight="4dp" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:paddingTop="?android:attr/actionBarSize" >

            <TextView
                android:id="@+id/main"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clickable="true"
                android:focusable="false"
                android:focusableInTouchMode="true"
                android:gravity="center"
                android:text="Main Content"
                android:textSize="16sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#eeeeee"
            android:clickable="true"
            android:focusable="false"
            android:orientation="vertical" >

            <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:gravity="center_vertical"
                    android:paddingLeft="10dp"
                    android:textSize="14sp" />

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

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:scaleType="fitStart"
                android:src="@drawable/graphic" >
            </ImageView>
        </LinearLayout>
    </com.sothree.slidinguppanel.demo.SlidingUpPanelLayout>
</RelativeLayout>
Zen
  • 2,698
  • 4
  • 28
  • 41
  • 1) you should put that pastebin in the question. 2) It looks like a 'normal' custom view doesn't show up in eclipse xml viewer. See: http://stackoverflow.com/questions/10743030/custom-android-views-in-eclipse-visual-editor – Morrison Chang Apr 24 '14 at 22:39

1 Answers1

0

Custom Views usually don't render in the UI editor in Eclipse or IntelliJ. It's not tragic.

The stack trace however suggests that you should use View.isInEditMode() to skip the rendering if the custom View is just being displayed in the UI editor.

You can just add this:

if(isInEditMode()){
    return;
}

after this line in the custom View, if you're using a local copy of the library. Or just send a pull request to the repo on Github, that adds that.

Ahmad
  • 69,608
  • 17
  • 111
  • 137
  • that returns an error. "The blank final field mShadowDrawable may not have been initialized" mShadowDrawable is a drawable – Zen Apr 24 '14 at 22:51
  • @alexsummers That's not an error that's juts a warning. You can safely ignore that. – Ahmad Apr 24 '14 at 22:54
  • nah, still doesnt render. – Zen Apr 24 '14 at 23:01
  • @alexsummers It won't render. The UI editor in Eclipse and IntelliJ is not laid out to render complex custom Views. These 2 lines however prevent the UI editor to spit out these warnings that the custom View can't be rendered. – Ahmad Apr 24 '14 at 23:02
  • oh. Should be an online app of some sort where you paste your java+xml and it lets your create your custom view and edit it – Zen Apr 24 '14 at 23:07