i attempting text appear in centre of imageview. using xml (below) see text wedged in top left of framelayout. did wrong?
<framelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1" > <imageview android:id="@+id/levbut" android:layout_width="wrap_content" android:layout_height="match_parent" android:scaletype="centerinside" android:src="@drawable/starbut" /> <textview android:id="@+id/tvtest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello" /> </framelayout>
you can either add gravity framelayout, layout_gravity textview, or change relativelayout , add centerinparent="true".
<framelayout ... android:gravity="center"> or
<framelayout ... /> <textview ... android:layout_gravity="center" /> </framelayout> or
<reltivelayout ...> <imageview ... /> <textview ... android:layout_centerinparent="true" /> </relativelayout>
Comments
Post a Comment