The Niko
's answer is completely correct, but in case you don't want to use FrameLayout
, all you have to do is using android:layout_centerInParent="true"
, check the below code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<AnalogClock
android:id="@+id/analogClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:text="YouText"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@android:color/black" />
</RelativeLayout>
And this is the result: