我是新来的机器人,并试图使用xml作为背景circular layouts
。现在我有一个父亲相对布局,它有一个孩子相对布局。父级相对布局具有带角半径的背景xml,并显示为圆形。现在内部的相对布局/子布局也必须继承这个并成为一个正确的圆圈,但事实并非如此!子布局的高度和宽度为match_parent
& match_parent
。那么,如何让子布局的高度和宽度适合父级的圈?如何设置高度和子布局以适应父布局?
<RelativeLayout
android:layout_marginTop="12dp"
android:layout_below="@+id/view10"
android:layout_centerHorizontal="true"
android:layout_width="52dp"
android:gravity="center"
android:background="@drawable/dutycirclebackground"
android:layout_height="52dp">
<RelativeLayout
android:visibility="visible"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent">
</RelativeLayout>
</RelativeLayout>
这是背景XML
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#cc5228"/>
<corners
android:bottomRightRadius="25dp"
android:bottomLeftRadius="25dp"
android:topLeftRadius="25dp"
android:topRightRadius="25dp"/>
</shape>
这里,如果我设置背景颜色到内部布局和检查输出,我收到了square layout
但parent is a circle
。
在此先感谢!
删除安卓重力=“中心”子布局 – sasikumar
@sasikumar,删除和检查,但仍然是一个方形 –
@Sidharth MA没有ü运行在一个实际的设计? –