我想在android中将按钮(子视图)带到前面

imm*_*odi 7 android android-layout

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/topHeader"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" >


      <!-- Header aligned to top -->
    <!--   <include layout="@layout/header_layout" /> -->

      <!-- Footer aligned to bottom -->
    <!--   <include layout="@layout/footer_layout" /> -->

      <!-- Content below header and above footer -->
    <!--   <include layout="@layout/intermediate_layout" /> -->
      <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center">

        <ImageView
        android:id="@+id/imgLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/header" />
      </RelativeLayout>

    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我制作布局xml,其中我将一个按钮放在中心.我希望该按钮始终在前面.我在这个布局上动态添加了一些textview,imageview等,并且应该将一个中心按钮带到前面.这在ios中是可能的,我想在android.Any建议这个想法?我上面有topHeaderlayout.xml 在这个xml中,我动态添加了view.And按钮应该在视图的前面.

art*_*grn 13

您可以使用bringToFront方法(http://developer.android.com/reference/android/view/View.html).另请阅读此内容 - 在Android中定义RelativeLayout的Z顺序视图.我认为这应该有所帮助.