本文介绍了不能点击SlidingUpPanelLayout儿童按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我用SlidingUpPanelLayout在我的项目,我有一个问题吧。
我SlidingUpPanelLayout有2个孩子。
1)ListView控件用于显示数据的列表 - 这是内容
2)的LinearLayout与他的孩子(textvien,EditText上,按钮) - 这是向上滑动面板

当SlidingUpPanelLayout正显示出我尝试点击我的按钮,我SlidingUpPanelLayout立即关闭了,我不能点击我的按钮的EditText。
如何才能摆脱这件事?
我怎么可以设定点击/上某些View显示面板?

谢谢!

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>
    < com.sothree.slidinguppanel.SlidingUpPanelLayout
        机器人:ID =@ + ID / sliding_layout
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent>
        < ListView控件
            机器人:paddingLeft =10dp
            机器人:paddingRight =10dp
            机器人:分=@绘制/ shape_divider_comments
            机器人:dividerHeight =1DP
            机器人:ID =@ + ID / lvReviews
            机器人:知名度=水涨船高
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent>
        < /&的ListView GT;
        <的LinearLayout
            机器人:ID =@ + ID / rlSlidingContent
            机器人:比重=中心|顶
            机器人:方向=垂直
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent>
            <滚动型
                机器人:知名度=看得见
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent>
                    <的LinearLayout
                        机器人:layout_width =match_parent
                        机器人:layout_height =match_parent
                        机器人:方向=垂直>
                        <的EditText
                            风格=@风格/ StyleEditText
                            机器人:ID =@ + ID / etPersonName
                            机器人:layout_width =match_parent
                            机器人:layout_height =WRAP_CONTENT
                            机器人:EMS =10
                            机器人:提示=@字符串/ your_name_hint
                            安卓的inputType =textPersonName>                        < /&的EditText GT;
                        <按钮
                            风格=@风格/ StyleButton
                            机器人:知名度=看得见
                            机器人:ID =@ + ID / btnAddComment
                            机器人:layout_gravity =中心
                            机器人:layout_width =WRAP_CONTENT
                            机器人:layout_height =WRAP_CONTENT
                            机器人:文字=添加/>
                    < / LinearLayout中>
                < /滚动型>
        < / LinearLayout中>
    < /com.sothree.slidinguppanel.SlidingUpPanelLayout>
< / RelativeLayout的>


解决方案

退房的方法 setDragView 将其重新presents的抽屉的处理。
另外,检查你的意见透支,可以简化您的布局,
例如:

   

 < com.sothree.slidinguppanel.SlidingUpPanelLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / sliding_layout
机器人:layout_width =match_parent
机器人:layout_height =match_parent>< ListView控件
    机器人:ID =@ + ID / lvReviews
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:分=@绘制/ shape_divider_comments
    机器人:dividerHeight =1DP
    机器人:paddingLeft =10dp
    机器人:paddingRight =10dp
    机器人:知名度=水涨船高/><滚动型
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:fillViewport =真
    机器人:知名度=看得见>    <的LinearLayout
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:方向=垂直>        <的EditText
            机器人:ID =@ + ID / etPersonName
            风格=@风格/ StyleEditText
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:EMS =10
            机器人:提示=@字符串/ your_name_hint
            安卓的inputType =textPersonName>        < /&的EditText GT;        <按钮
            机器人:ID =@ + ID / btnAddComment
            风格=@风格/ StyleButton
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_gravity =中心
            机器人:文字=添加
            机器人:知名度=看得见/>
    < / LinearLayout中>
< /滚动型>< /com.sothree.slidinguppanel.SlidingUpPanelLayout>

渲染少得多的透支相同

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

这篇关于不能点击SlidingUpPanelLayout儿童按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 08:56