2016-07-17 9 views
2

ラベルの行をSeekBarのステップで整列したいと思います。 enter image description hereシークバーをAndroidのラベルで整列する

しかしとして:スライダーdosen'tが正確に右に開始し、これが結果です

を残しているため、左右のパディングが必要とされている

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

: 私はこれをやっていますあなたはステッパーを動かすと、ラベルのカップルは、それと一緒にdisalignedを終了します。 これを達成する方法はありますか?

+0

の代わりのLinearLayoutを使用relativelayout問題 – SaravInfern

+0

Ehy @SaravInfern、コメントに感謝を解決する可能性があります:それは、箱から出して非常に包括的で柔軟なソリューションを持っています。それはどのように私の問題を解決することができますか?私が使用できるいくつかのプロパティをお勧めしますか?ありがとう –

+0

idsに基づいてラベルを左または右に揃えることができます。開発者のドキュメントhttps://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html – SaravInfern

答えて

関連する問題