如何将Imageview放在其他布局后面 [英] How to put Imageview Behind other layout

查看:56
本文介绍了如何将Imageview放在其他布局后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用imageview进行动画处理,因此它看起来像是从左到右的移动. 但我的图像显示在其他视图的前面,以便用户可以单击图像. 我试图将其显示在其他视图的后面.

I am using a imageview for animation so that it will look like movement left to right. but my image is displaying front of other views so that user is able to click on image. i am trying to display it behind the other view.

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
    android:id="@+id/layout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@drawable/main_bg2"
    >

     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >

     <Button
         android:id="@+id/languageChangePopup"
         style="?android:attr/buttonStyleSmall"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginBottom="10dp"
         android:layout_marginLeft="50dp"
         android:background="@drawable/startbtn" />

    <EditText
        android:id="@+id/showOutputEdit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="110dp"
        android:layout_marginTop="50dp"
        android:background="@drawable/display_textbx"
        android:cursorVisible="false"
        android:gravity="right|center"
        android:paddingLeft="70dp"
        android:paddingRight="70dp"
        android:textColor="#ffffff"
        android:textSize="45sp"
        android:textStyle="bold" />

    </LinearLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent" android:layout_weight="3.49">

        <TableLayout
            android:id="@+id/tableLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="136dp"
            android:layout_marginTop="19dp" >

            <TableRow
                android:id="@+id/tableRow5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 >

                <Button
                    android:id="@+id/clearBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/cbtn" />

                <Button
                    android:id="@+id/sevenBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/sevenbtn" />

                <Button
                    android:id="@+id/eightBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/eightbtn" />

                <Button
                    android:id="@+id/nineBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/ninebtn" />
            </TableRow>

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 >

                <Button
                    android:id="@+id/dotBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/dotbtn" />

                <Button
                    android:id="@+id/fourBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/fourbtn" />

                <Button
                    android:id="@+id/fiveBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/fivebtn" />

                <Button
                    android:id="@+id/sixBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/sixbtn" />
            </TableRow>

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 >

                <Button
                    android:id="@+id/zeroBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/zerobtn" />

                <Button
                    android:id="@+id/oneBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/onebtn" />

                <Button
                    android:id="@+id/twoBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/twobtn" />

                <Button
                    android:id="@+id/threeBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@string/threebtn" />
            </TableRow>

              </TableLayout>



        <LinearLayout
            android:id="@+id/layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginTop="16dp"
            android:layout_toRightOf="@+id/tableLayout1"
            android:background="@drawable/operation_planet"
            android:orientation="vertical" >

            <Button
                android:id="@+id/plusBtn"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginRight="10dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/addbtn" />

            <Button
                android:id="@+id/minusBtn"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_marginRight="80dp"
                android:layout_marginTop="30dp"
                android:background="@drawable/minusbtn" />

                <Button
                    android:id="@+id/multiplyBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="15dp"
                    android:layout_marginTop="20dp"
                    android:background="@drawable/multiplybtn" />

                <Button
                    android:id="@+id/divideBtn"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginTop="30dp"
                    android:background="@drawable/dividebtn" />

        </LinearLayout>

                <Button
                    android:id="@+id/equalToBtn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_marginBottom="21dp"
                    android:layout_toRightOf="@+id/tableLayout1"
                    android:background="@drawable/equaltobtn"
                    android:gravity="right" />

                <ImageView
                    android:id="@+id/rocketImage"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignTop="@+id/layout"
                    android:background="@drawable/spaceship" />

    </RelativeLayout>

</LinearLayout>

推荐答案

将图像视图放在上方(在顶部-父级的第一个孩子)
xml文件中的布局,以使图像位于布局后面

Put the image view above (on top - first child of the parent)
the layout in the xml file that way the image will be behind the layout

这篇关于如何将Imageview放在其他布局后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆