Не могу нажать кнопку детей в SlidingUpPanelLayout

Я использую SlidingUpPanelLayout в своем проекте, и у меня есть проблема с ним. У моего SlidingUpPanelLayout 2 детей. 1) ListView для отображения списка данных - это контент. 2) LinearLayout со своими дочерними элементами (textvien, edittext, button) - это панель, сдвигаемая вверх.

Когда SlidingUpPanelLayout показывает, я пытаюсь нажать на мою кнопку, и мой SlidingUpPanelLayout немедленно закрывается, и я не могу нажать на мою кнопку и изменить текст. Как я могу избавиться от этого? Как я могу настроить панель Click/ Show в некоторых View?

Спасибо!

<?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>

1 ответ

Решение

Проверьте метод setDragView это представляет "ручку" ящика. Кроме того, проверьте перерасход ваших просмотров, вы можете упростить макет, например:

<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>

делает то же самое с гораздо меньшим оверлеем

Другие вопросы по тегам