[英]How to place center of layout on top-right corner of another layout?
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. @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 />
.现在<TextView />
的右上角位于<RelativeLayout />
右上角,但我想将<TextView />
的中心放在<ImageViwq />
右上角。
How should I construct my XML file?我应该如何构建我的 XML 文件?
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.如果需要,调整“-5dip”。 This value should be roughly half the size of your small View.这个值应该大约是你的小视图大小的一半。
使用android:layout_alignParent并调整android:layout_margin以获得您想要的视图...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.