How to place center of layout on top-right corner of another layout?
android, android-layout, android-relativelayout
Solution
Use this on your small view
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="-5dip"
android:layout_marginRight="-5dip"
Adjust the "-5dip"s if need be. This value should be roughly half the size of your small View.
Problem
I have: ``` <RelativeLayout style="@style/w_w" android:gravity="top|center" android:layout_marginBottom="10sp"> <ImageView android:id="@+id/icon" style="@style/w_w" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@drawable/icon" /> <TextView android:text="F" android:id="@+id/temp" style="@style/w_w" android:textColor="#ffffff" android:textSize="10sp" android:textStyle="bold" android:gravity="top|center"/> </RelativeLayout> ``` `@style/w_w` - layout_height="wrap_content"=layout_width. Now `<TextView />`'s right-top is in right-top corner of `<RelativeLayout />`, but I'd like to place `<TextView />`'s center in right-top corner of `<ImageViwq />`. How should I construct my XML file?