有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java项显示在相对布局的前面

我正在添加一个相对布局,并且项目显示在它的前面,我甚至可以选择它们,即使我将相对布局放在XML的末尾

<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:scaleType="center"
安卓:layout_alignParentTop="true"
tools:context="julienkessels.com.daredrink.SettingsActivity">
<ImageView
    安卓:layout_width="match_parent"
    安卓:layout_height="match_parent"
    安卓:scaleType="fitXY"
    安卓:adjustViewBounds="true"
    安卓:id="@+id/imageView"
    安卓:src="@drawable/backgroundpaperr"
    安卓:alpha="0.45"/>

<Button
    安卓:id="@+id/btnHome"
    安卓:layout_width="70sp"
    安卓:layout_height="60sp"
    安卓:src="@drawable/home"
    安卓:background="@drawable/home"
    安卓:layout_marginBottom="20dp"
    安卓:layout_alignParentBottom="true"
    安卓:layout_centerHorizontal="true"
    />

<TextView
    安卓:text="Remove Ads :"
    安卓:layout_width="300sp"
    安卓:layout_height="40sp"
    安卓:textSize="20sp"
    安卓:layout_centerHorizontal="true"
    安卓:textAlignment="center"
    安卓:layout_alignBottom="@+id/btnRemoveAdss"
    安卓:layout_marginBottom="100sp"
    安卓:id="@+id/txtRemoveAds" />

<Button
    安卓:text=""
    安卓:layout_width="200sp"
    安卓:layout_height="100sp"
    安卓:layout_centerHorizontal="true"
    安卓:layout_marginTop="80dp"
    安卓:id="@+id/btnRemoveAdss"
    安卓:src="@drawable/newremoveads"
    安卓:background="@drawable/newremoveads"        />

<TextView
    安卓:text="Add your own rules :"
    安卓:layout_width="300sp"
    安卓:layout_height="40sp"
    安卓:textSize="20sp"
    安卓:layout_centerHorizontal="true"
    安卓:textAlignment="center"
    安卓:layout_alignBottom="@+id/btnAddRule"
    安卓:layout_marginBottom="100sp"
    安卓:id="@+id/txtAddRule" />

<Button
    安卓:text=""
    安卓:layout_width="200sp"
    安卓:layout_height="100sp"
    安卓:layout_centerHorizontal="true"
    安卓:layout_marginTop="250dp"
    安卓:id="@+id/btnAddRule"
    安卓:src="@drawable/house"
    安卓:background="@drawable/house"
    />
<TextView
    安卓:text="Choose your language :"
    安卓:layout_width="300sp"
    安卓:layout_height="40sp"
    安卓:textSize="20sp"
    安卓:layout_centerHorizontal="true"
    安卓:textAlignment="center"
    安卓:layout_alignBottom="@+id/spinnerLanguageSettings"
    安卓:layout_marginBottom="40sp"
    安卓:id="@+id/txtLanguageSpinner" />
<Spinner
    安卓:id="@+id/spinnerLanguageSettings"
    安卓:popupBackground="#cccccc"
    安卓:popupTheme="@安卓:style/Theme.Holo.Light"
    安卓:textColor="@安卓:color/black"
    安卓:layout_width="250dp"
    安卓:layout_height="40dp"
    安卓:layout_centerHorizontal="true"
    安卓:layout_marginTop="420dp"
    安卓:background="@drawable/spinnerbg" />

<RelativeLayout
    安卓:layout_width="match_parent"
    安卓:layout_height="match_parent"
    安卓:alpha="1"
    安卓:id="@+id/subViewOwnRules"
    安卓:layout_marginTop="20dp"
    安卓:layout_marginBottom="20dp"
    安卓:layout_marginLeft="20dp"
    安卓:layout_marginRight="20dp"
    安卓:layout_alignParentTop="true"
    安卓:layout_centerHorizontal="true"
    tools:alpha="1">

    <ImageView
        安卓:layout_width="match_parent"
        安卓:layout_height="match_parent"
        安卓:scaleType="fitXY"
        安卓:adjustViewBounds="true"
        安卓:id="@+id/test"
        安卓:src="@drawable/subview1"
        安卓:alpha="0.9"
        tools:alpha="0.9" />

    <Button
        安卓:id="@+id/btnBack"
        安卓:layout_width="150sp"
        安卓:layout_height="50sp"
        安卓:src="@drawable/next"
        安卓:background="@drawable/back"
        安卓:layout_marginBottom="20dp"
        安卓:layout_alignParentBottom="true"
        安卓:layout_centerHorizontal="true" />

</RelativeLayout>

我在网上找不到任何解释。这就是它目前的样子:

http://i.stack.imgur.com/Tnm3Z.png

广告和房屋规则按钮应该在子视图下方,我缺少什么


共 (1) 个答案

  1. # 1 楼答案

    将此添加到您的RelativeLayout,以便它可以接收单击事件

    android:clickable="true"