I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text
I want to center both in the FrameLayo
I'd suggest a RelativeLayout instead of a FrameLayout.
Assuming that you want to have the TextView always below the ImageView I'd use following layout.
Note that if you set the visibility
of an element to gone
then the space that element would consume is gone whereas when you use invisible
instead the space it'd consume will be preserved.
If you want to have the TextView on top of the ImageView then simply leave out the android:layout_alignParentTop
or set it to false
and on the TextView leave out the android:layout_below="@id/imageview"
attribute. Like this.
I hope this is what you were looking for.