2016-10-22 3 views
-1

LinearLayout의 특정 사각형 공간이 있습니다. 이 내에서 LinearLayout 나는 RelativeLayout 높이와 너비가 100dp 있습니다. 이 RelativeLayout에는 원형 드로어 블 모양이 있습니다. 나는 RelativeLayout의 높이와 너비를 부모가 사용할 수있는 총 공간의 60 %가되도록 설정하려고합니다. LinearLayout. 이것을 할 수있는 방법이 있습니까? 상대 레이아웃의 높이와 너비를 백분율로 설정하는 방법

내가 enter image description here

설계하고 레이아웃입니다 이것은 하나 개의 원형보기

<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> 
+0

당신이 거기 –

+0

1. 비율에 따라 새로운 제약 레이아웃과 설정 지침을 사용할 수 있습니다 당신이 달성하기를 원하는 것에 대한 많은 해답이 있습니다. 그래서 그 높이는 60 %가되는 것입니다. 2. 레이아웃이 잘못 작성되어 앱 성능에 영향을 미칠 수 있습니다. 3. 포인트 1에 대해 회신하면 # 1 및 # 2를 추가로 지원할 수 있습니다 –

+0

이 레이아웃을 나타내는 가장 좋은 방법을 제안 해주세요. –

답변

관련 문제