문제

I use SlidingUpPanelLayout in my project and i have a problem with it. My SlidingUpPanelLayout has 2 children. 1) ListView for showing list of data - this is content 2) LinearLayout with his children (textvien, edittext, button) - this is slide up panel

When SlidingUpPanelLayout is showing i try to click on my button, and my SlidingUpPanelLayout immediately close, and i can't click on my button and edittext. How can i get rid of this? how can i setup click/show up panel on some View?

thanks!

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"> 
    <com.sothree.slidinguppanel.SlidingUpPanelLayout
        android:id="@+id/sliding_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >          
        <ListView               
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:divider="@drawable/shape_divider_comments"
            android:dividerHeight="1dp"
            android:id="@+id/lvReviews"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </ListView>
        <LinearLayout
            android:id="@+id/rlSlidingContent"
            android:gravity="center|top"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >              
            <ScrollView
                android:visibility="visible"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
                    <LinearLayout 
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">                     
                        <EditText
                            style="@style/StyleEditText"
                            android:id="@+id/etPersonName"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:ems="10"
                            android:hint="@string/your_name_hint"
                            android:inputType="textPersonName" >

                        </EditText>                                                 
                        <Button
                            style="@style/StyleButton"
                            android:visibility="visible"
                            android:id="@+id/btnAddComment"
                            android:layout_gravity="center"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Add" />
                    </LinearLayout>
                </ScrollView>
        </LinearLayout>
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>
</RelativeLayout>
도움이 되었습니까?

해결책

Check out the method setDragView it represents the "handle" of the drawer. Also, check the overdraw of your views, you could simplify your layout, for example:

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ListView
    android:id="@+id/lvReviews"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="@drawable/shape_divider_comments"
    android:dividerHeight="1dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:visibility="gone" />

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:visibility="visible">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <EditText
            android:id="@+id/etPersonName"
            style="@style/StyleEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:hint="@string/your_name_hint"
            android:inputType="textPersonName">

        </EditText>

        <Button
            android:id="@+id/btnAddComment"
            style="@style/StyleButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Add"
            android:visibility="visible" />
    </LinearLayout>
</ScrollView>

</com.sothree.slidinguppanel.SlidingUpPanelLayout>

renders the same with far less overdraw

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top