冯琪88 2019-07-19 16:48 采纳率: 0%
浏览 391
已结题

RelativeLayout布局单击子布局没反应,父布局已经绑定了单击控件,也做了穿透

图片说明
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"

android:focusableInTouchMode="true"
android:id="@+id/relativeLayout1">

<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent"
    android:id="@+id/rL1"
    android:clickable="false"
    android:focusable="false" >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="欢迎您"
        android:textSize="18dp"
        android:textColor="@color/red"
        android:id="@+id/text_rl1"

        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:background="#00000000"
        android:visibility="gone"

        android:id="@+id/fl_1_1_rl1" />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"

        android:id="@+id/fl_1_2_rl1" />
    <RelativeLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="100dp"
        android:background="@android:color/transparent"
        android:layout_height="100dp"
        android:visibility="gone"
        android:id="@+id/qrcode_rl1"

        android:descendantFocusability="beforeDescendants">
        <ImageView
            android:id="@+id/img_qrcode_rl1"
            android:layout_width="96dp"
            android:layout_height="96dp"
            android:layout_marginLeft="3dp"
            android:layout_marginTop="3dp"
            android:layout_marginBottom="3dp"
            android:layout_marginRight="3dp"

            android:background="@android:color/transparent"
            android:scaleType="fitCenter" />
    </RelativeLayout>
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone"
    android:background="@android:color/transparent"
    android:id="@+id/rL2"
    android:clickable="false"
    android:focusable="false">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="欢迎您"
        android:textSize="18dp"
        android:textColor="@color/red"
        android:id="@+id/text_rl2"
        android:layout_centerHorizontal="true"
       />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"

        android:id="@+id/fl_2_1_rl2" />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"

        android:id="@+id/fl_2_2_rl2" />
    <RelativeLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="wrap_content"
        android:background="@android:color/transparent"
        android:layout_height="64dp"
        android:visibility="gone"

        android:id="@+id/qrcode_rl2" />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone"
    android:background="@android:color/transparent"
    android:id="@+id/rL3"
    android:clickable="false"
    android:focusable="false">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="欢迎您"
        android:textSize="18dp"
        android:textColor="@color/red"
        android:id="@+id/text_rl3"
        android:layout_centerHorizontal="true"
         />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"
        android:id="@+id/fl_3_1_rl3" 
    />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"
        android:id="@+id/fl_3_2_rl3"
        />
    <RelativeLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="wrap_content"
        android:background="@android:color/transparent"
        android:layout_height="64dp"
        android:visibility="gone"

        android:id="@+id/qrcode_rl3" />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="gone"
    android:background="@android:color/transparent"
    android:id="@+id/rL4"
    android:clickable="false"
    android:focusable="false">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="欢迎您"
        android:textSize="18dp"
        android:textColor="@color/red"
        android:id="@+id/text_rl4"
        android:layout_centerHorizontal="true"
         />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"
        android:id="@+id/fl_4_1_rl4" 
        />
    <FrameLayout
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:visibility="gone"
        android:background="#00000000"
        android:id="@+id/fl_4_2_rl4" 
       />
    <RelativeLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="wrap_content"
        android:background="@android:color/transparent"
        android:layout_height="64dp"
        android:visibility="gone"
        android:id="@+id/qrcode_rl4" 
        />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone"
    android:id="@+id/rLTextMove"
    android:clickable="false"
    android:focusable="false">
    <zclhPlay.FiveTextView
        android:id="@+id/Textmove"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text=" "
        android:textColor="#fff"
        android:textSize="12dp" />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="match_parent"
    android:layout_height="64dp"
    android:visibility="gone"
    android:id="@+id/rLTopBanners"
    android:clickable="false"
    android:focusable="false">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:visibility="visible"

        android:id="@+id/imgTopBanners" />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="wrap_content"
    android:background="@android:color/transparent"
    android:visibility="gone"
    android:layout_height="64dp"
    android:id="@+id/rLClock"
    android:clickable="false"
    android:focusable="false">
    <TextView
        android:id="@+id/text_clock"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20dp"
        android:textColor="#ffffffff"
        android:shadowColor="#ff000000"
        android:text=""
        android:layout_marginLeft="5dp"
        android:shadowRadius="1"
        android:shadowDx="2"
        android:shadowDy="2" />
    <TextView
        android:id="@+id/text_clock_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#ffffffff"
        android:shadowColor="#ff000000"
        android:text=""
        android:layout_marginLeft="0dp"
        android:layout_marginTop="22dp"
        android:shadowRadius="1"
        android:shadowDx="2"
        android:shadowDy="2" />
</RelativeLayout>
<RelativeLayout
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="wrap_content"
    android:background="@android:color/transparent"
    android:layout_height="64dp"
    android:visibility="gone"
    android:id="@+id/rLWeather"
    android:clickable="false"
    android:focusable="false">

    <ImageView
        android:id="@+id/imageviewCond"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_marginLeft="0dp"
        android:layout_marginTop="3dp"
        android:background="@android:color/transparent"
        android:scaleType="fitCenter" />
    <TextView
        android:id="@+id/text_temperature"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20dp"
        android:textColor="#ffffffff"
        android:shadowColor="#ff000000"
        android:text=""
        android:layout_marginLeft="40dp"
        android:shadowRadius="1"
        android:shadowDx="2"
        android:shadowDy="2" />
    <TextView
        android:id="@+id/text_wind"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#ffffffff"
        android:shadowColor="#ff000000"
        android:text=""
        android:layout_marginLeft="34dp"
        android:layout_marginTop="22dp"
        android:shadowRadius="1"
        android:shadowDx="2"
        android:shadowDy="2" />
</RelativeLayout>


如上图,单击第一个父布局RelativeLayout有反应,单击中间八个没有反应,父布局已经绑定了单击控件,也做了穿透,八个子布局是全屏的,轮流播放图片,如果单击中图片切换中间的间隔时单击就有反应,图片上没有反应

  • 写回答

3条回答 默认 最新

  • lorddd 2019-07-19 16:55
    关注

    不应该有 clickable=true focusable..这两行
    各自己绷定自己的 onclick就行了.只要没蔗档,点到那个控件就那个响应了

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题