Hi I am having trouble centering my text view in an image view. I want it to look kinda like this but have it actually vertically centered and stay vertically centered if the the font size changes.
And here is what I have in XML I don't care if I need to change the relative layout to another kind that doesn't matter to me I just want to be able to center this. Heres the xml:
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.spencer.app.ProfileActivity"
android:id="@+id/layout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="140dp"
android:minWidth="140dp"
android:id="@+id/logoBackground"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_marginTop="25dp"
android:contentDescription="@string/content_description_useless"
android:background="#ffffd0cd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/capital_u"
android:id="@+id/u_textView"
android:textSize="80sp"
android:layout_marginLeft="31dp"
android:layout_marginStart="31dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_alignTop="@+id/logoBackground"
android:layout_alignLeft="@+id/logoBackground"
android:layout_alignStart="@+id/logoBackground" />
</RelativeLayout>
Thanks for the help in advance.
No comments:
Post a Comment