Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to bring button(subview) to front in android

    <?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>

I make layout xml, in which I put one button in center.And I want that button to front always. I adding some textview, imageview etc dynamically on this layout and that one centerised button should be bring front. This is possible in ios and i want in android.Any suggestion for this thoughts? I have above topHeaderlayout.xml In this xml, I dynamically adds view.And one button should be front of view.

like image 349
immodi Avatar asked Nov 20 '13 13:11

immodi


1 Answers

You may use bringToFront method (http://developer.android.com/reference/android/view/View.html). Also please read this — Defining Z order of views of RelativeLayout in Android. I think this should help.

like image 110
artemiygrn Avatar answered Nov 15 '22 22:11

artemiygrn