I've got a FrameLayout like this. It contains two overlaying images:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/image_areas"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:src="@drawable/image_mask"
android:visibility="invisible"/>
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:src="@drawable/walker"/>
</FrameLayout>
I want to add a TextView
below this FrameLayout
. Is it possible or does FrameLayout
take all the space on the screen? Can I put my FrameLayout and TextView in a sort of LinearLayout
?
Edit: The problem is that my TextView
is not displayed when Im putting it in a LinearLayout or RelaiveLayout together with my FrameLayout.
You can use a RelativeLayout
to hold both your FrameLayout
and TextView
and in your FrameLayout
use the android:layout_above
atribute. Something like this:
<?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" >
<FrameLayout
android:id="@+id/my_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/TextViewId" >
<ImageView
android:id="@+id/image_areas"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:src="@android:drawable/alert_dark_frame"
android:visibility="invisible" />
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:src="@android:drawable/btn_dialog" />
</FrameLayout>
<TextView
android:id="@+id/TextViewId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="TextView text" />
</RelativeLayout>
<FrameLayout
android:id="@+id/my_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_areas"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@android:drawable/alert_dark_frame"
android:visibility="invisible" />
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@android:drawable/btn_dialog" />
<TextView
android:id="@+id/TextViewId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="layout_gravity is the key here..."/>
</FrameLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With