I have a certain square space for my LinearLayout
. Within this LinearLayout
i have a RelativeLayout
with height and width 100dp
. This RelativeLayout
has a circular drawable shape. I want to set the height and width of RelativeLayout
to be 60% of total space available for its parent LinearLayout
. Is there a way to do this?
This is the layout which i am designing
This is my xml code snippet of one circular view
<RelativeLayout
android:id="@+id/rl_hatchback"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_hatchback_circle"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/circle_red"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_hatchback"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_hatchback_circle"
android:text="Hatchback"
style="@style/CircularTitle"
/>
</LinearLayout>