2016-07-17 2 views
2

레이블의 행을 SeekBar의 단계로 정렬하고 싶습니다. 나는이 일을 해요 :안드로이드에서 레이블로 검색 바 정렬

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:id="@+id/labelsll" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp"> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:text="XS" 
      android:textColor="@color/primary"/> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:gravity="center" 
      android:text="S" 
      android:textColor="@color/primary"/> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:gravity="center" 
      android:text="M" 
      android:textColor="@color/primary"/> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:gravity="center" 
      android:text="L" 
      android:textColor="@color/primary"/> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="1" 
      android:gravity="right" 
      android:text="XL" 
      android:textColor="@color/primary"/> 
    </LinearLayout> 

    <SeekBar 
     android:id="@+id/seekBar1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:max="4"/> 
</LinearLayout> 

왼쪽과 오른쪽 패딩을 필요 슬라이더 나던 정확히 오른쪽 시작

남아 있기 때문 결과입니다 enter image description here

그러나 같은 스테퍼를 움직이면 두 개의 라벨이 끝나 버립니다. 이 작업을 수행하는 방법은 무엇입니까?

+0

대신 LinearLayout을 사용 RelativeLayout의 문제 – SaravInfern

+0

Ehy @SaravInfern 주석에 대한 감사를 해결할 수 있습니다 그것은 상자 밖으로 매우 포괄적이고 유연한 솔루션을 제공합니다. 어느면에서 내 문제를 해결할 수 있습니까? 내가 사용할 수있는 물건을 제안 해 주시겠습니까? 감사합니다 –

+0

왼쪽 또는 오른쪽으로 ID를 기준으로 레이블을 정렬 할 수 있습니다 개발자 문서를 확인하십시오 https://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html – SaravInfern

답변