Android Studio如何使相对布局围绕相对布局循环?
我希望我的所有相对布局都围绕一个圆形的相对布局 这是我的 有什么办法可以让这一切顺利进行吗 这是我的XML代码,我没有任何约束,因为它们似乎没有帮助Android Studio如何使相对布局围绕相对布局循环?,android,xml,android-layout,android-studio,Android,Xml,Android Layout,Android Studio,我希望我的所有相对布局都围绕一个圆形的相对布局 这是我的 有什么办法可以让这一切顺利进行吗 这是我的XML代码,我没有任何约束,因为它们似乎没有帮助 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://sche
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.alexei.roses.ImageDescription"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">
<RelativeLayout
android:id="@+id/s1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="36dp"
tools:layout_editor_absoluteY="16dp">
<TextView
android:id="@+id/geo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/circulargeo"
android:layout_centerHorizontal="true"
android:text="Geographic Origin"
android:textAlignment="center"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="bold"
tools:layout_editor_absoluteX="234dp"
tools:layout_editor_absoluteY="119dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circulargeo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="@drawable/geographic"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="248dp"
tools:layout_editor_absoluteY="16dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/s2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="7dp"
tools:layout_editor_absoluteY="181dp">
<TextView
android:id="@+id/sci"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/circularsci"
android:layout_centerHorizontal="true"
android:text="Scientific Name"
android:textAlignment="center"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="bold"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circularsci"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/scientificname"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="28dp"
tools:layout_editor_absoluteY="327dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/s3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteY="326dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:id="@+id/cha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/circularcha"
android:layout_centerHorizontal="true"
android:text="Characteristics"
android:textAlignment="center"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="bold"
tools:layout_editor_absoluteX="234dp"
tools:layout_editor_absoluteY="119dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circularcha"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="@drawable/characteristics"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="248dp"
tools:layout_editor_absoluteY="16dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/s4"
android:layout_width="wrap_content"
android:layout_height="0dp"
tools:layout_editor_absoluteY="181dp"
tools:layout_editor_absoluteX="278dp">
<TextView
android:id="@+id/cul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/circularcul"
android:layout_centerHorizontal="true"
android:text="Cultivation"
android:textAlignment="center"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="bold"
tools:layout_editor_absoluteX="-243dp"
tools:layout_editor_absoluteY="53dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circularcul"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="@drawable/cultivation"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="248dp"
tools:layout_editor_absoluteY="16dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/s5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:layout_editor_absoluteX="253dp"
tools:layout_editor_absoluteY="16dp">
<TextView
android:id="@+id/dis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/circulardis"
android:layout_centerHorizontal="true"
android:text="Diseases and Pests"
android:textAlignment="center"
android:textColor="@android:color/holo_blue_dark"
android:textStyle="bold"
tools:layout_editor_absoluteX="-243dp"
tools:layout_editor_absoluteY="53dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circulardis"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="@drawable/diseases"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="248dp"
tools:layout_editor_absoluteY="16dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/mainImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_editor_absoluteY="142dp">
<TextView
android:id="@+id/flowername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/flowerimage"
android:layout_centerHorizontal="true"
android:text="TextView"
android:textColor="@android:color/holo_blue_dark"
android:textSize="20sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="150dp"
tools:layout_editor_absoluteY="290dp" />
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/flowerimage"
android:layout_width="150dp"
android:layout_height="150dp"
app:civ_border_color="@android:color/holo_blue_dark"
app:civ_border_width="4dp"
android:src="@drawable/amaryllis"
app:civ_shadow="true"
app:civ_shadow_color="@android:color/black"
app:civ_shadow_radius="10"
tools:layout_editor_absoluteX="117dp"
tools:layout_editor_absoluteY="135dp" />
</RelativeLayout>
如果我得到了您想要的,如果您想要相关布局被舍入,我建议您在cardView中包装相对布局,然后设置cardCornerRadius
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:background="#FFFFFF"
android:layout_height="wrap_content"
card_view:cardCornerRadius="6dp"
card_view:contentPadding="4dp"
card_view:cardElevation="4dp"
card_view:cardMaxElevation="6dp"
card_view:cardBackgroundColor="#0077ff"
>
<RelativeLayout>
...
</RelativeLayout>
</android.support.v7.widget.CardView>
...
您可以使用属性提取您想要的内容如果我得到了您想要的内容,如果您希望相关布局被舍入,我建议您在cardView中包装相对布局,然后设置cardCornerRadius
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:background="#FFFFFF"
android:layout_height="wrap_content"
card_view:cardCornerRadius="6dp"
card_view:contentPadding="4dp"
card_view:cardElevation="4dp"
card_view:cardMaxElevation="6dp"
card_view:cardBackgroundColor="#0077ff"
>
<RelativeLayout>
...
</RelativeLayout>
</android.support.v7.widget.CardView>
...
您可以使用属性获取所需的内容也许您可以尝试ConstraintLayout?也许您可以尝试ConstraintLayout?我不希望对相对布局进行舍入。我想要一份圆形菜单。所有的小图片都在大图片周围均匀分布。我不希望一个相对的布局被舍入。我想要一份圆形菜单。所有的小图像在大图像周围均匀分布。