How to locate on view on the top and center of another one?
How to locate one view on the top and center of another one? So I want to have开发者_开发百科 an ImageButton
and TextView
under it but first one to be in the center and on top of second one.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:id="@+id/textView1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="SOME TEXT HERE"
android:layout_centerInParent="true" />
<ImageButton android:src="@drawable/icon" android:id="@+id/imageButton1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
You can make use of FrameLayout to achieve this
Example
精彩评论