我在项目中使用SlidingUpPanelLayout,但我遇到了问题。我的SlidingUpPanelLayout有两个孩子。1) ListView用于显示数据列表-这是内容2) LinearLayout和他的孩子们(textvien,edittext,按钮)-这是向上滑动面板
当SlidingUpPanelLayout显示时,我试图点击我的按钮,我的SlidingUpPanelLayout立即关闭,我无法点击我的按键并编辑文本。我该怎么摆脱这个?如何在某些视图上设置单击/显示面板?
谢谢!
<?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>
检查方法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>
使用更少的透支渲染相同