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

android, android-layout

Solution

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.

Problem

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

Original source