android - Horizontally center TextView inside ImageView -
how horizontally center textview inside imageview? positioned in lower right corner of imageview.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview" android:background="@drawable/img" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview" android:layout_alignbottom="@+id/imageview" android:layout_alignright="@+id/imageview" android:layout_alignend="@+id/imageview" /> </relativelayout>
if want textview
fit imageview
size independently positioned on relativelayout
should try this:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview" android:background="@drawable/img" /> <textview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/textview" android:text="hsjsdjhf" android:gravity="center" android:layout_aligntop="@id/imageview" android:layout_alignbottom="@id/imageview" android:layout_alignleft="@id/imageview" android:layout_alignright="@id/imageview" /> </relativelayout>
Comments
Post a Comment