2017-12-07 1 views
0

디스크리트 시크 바 (Discrete Seekbar)의 각 눈금 표시 위에 텍스트를 균등하게 분배하는 방법은 무엇입니까?안드로이드에서 이산 검색 바늘 진드기에 TextView를 고르게 분배하는 방법은 무엇입니까?

이 내가 뭐하는 거지 방법입니다

<SeekBar 
      android:id="@+id/sb_task_detail_status" 
      style="@style/Widget.AppCompat.SeekBar.Discrete" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:max="4" 
      android:progress="0" /> 

     <TableLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:stretchColumns="*" 
      android:layout_above="@+id/sb_task_detail_status" 
      android:layout_alignStart="@+id/sb_task_detail_status"> 

      <TableRow 
       android:id="@+id/statusRow" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 
       <TextView 
        android:id="@+id/tv_task_status_newly_developed" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_column="1" 
        android:textColor="@android:color/white" 
        android:textSize="10sp" 
        android:text="Newly Developed"/> 
       <TextView 
        android:id="@+id/tv_task_status_developed" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_column="2" 
        android:textSize="10sp" 
        android:textColor="@android:color/white" 
        android:text="Developed"/> 
       <TextView 
        android:id="@+id/tv_task_status_in_progress" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_column="3" 
        android:textSize="10sp" 
        android:textColor="@android:color/white" 
        android:text="In Progress"/> 
       <TextView 
        android:id="@+id/tv_task_status_completed" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_column="4" 
        android:textSize="10sp" 
        android:textColor="@android:color/white" 
        android:text="Completed"/> 
       <TextView 
        android:id="@+id/tv_task_status_submitted" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_column="5" 
        android:textSize="10sp" 
        android:textColor="@android:color/white" 
        android:text="Submitted"/> 
      </TableRow> 

     </TableLayout> 

을 그리고 이것은 내가 가진 결과입니다 : 하나의 텍스트 뷰는 한 번에 볼 수

enter image description here

주 진행에 따라 .

답변

0

layout_width="0dp"을 사용해 보았으며 비슷한 가중치를 할당 했습니까? 이와 같이 각 텍스트 뷰에 대한

android:layout_width="0dp" 
android:layout_weight="1" 

나는이 XML을 사용하고 누군가를 위해 공간을 균등하게

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
> 
<SeekBar 
    android:id="@+id/sb_task_detail_status" 
    style="@style/Widget.AppCompat.SeekBar.Discrete" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:max="4" 
    android:progress="0" /> 

<TableLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="*" 
    android:layout_above="@+id/sb_task_detail_status" 
    android:layout_alignStart="@+id/sb_task_detail_status"> 

    <TableRow 
     android:id="@+id/statusRow" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <TextView 
      android:id="@+id/tv_task_status_newly_developed" 
      android:layout_height="wrap_content" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_column="0" 
      android:textColor="@android:color/white" 
      android:textSize="10sp" 
      android:text="Newly Developed"/> 
     <TextView 
      android:id="@+id/tv_task_status_developed" 
      android:layout_height="wrap_content" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_column="1" 
      android:textSize="10sp" 
      android:textColor="@android:color/white" 
      android:text="Developed"/> 
     <TextView 
      android:id="@+id/tv_task_status_in_progress" 
      android:layout_height="wrap_content" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_column="2" 
      android:textSize="10sp" 
      android:textColor="@android:color/white" 
      android:text="In Progress"/> 
     <TextView 
      android:id="@+id/tv_task_status_completed" 
      android:layout_height="wrap_content" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_column="3" 
      android:textSize="10sp" 
      android:textColor="@android:color/white" 
      android:text="Completed"/> 
     <TextView 
      android:id="@+id/tv_task_status_submitted" 
      android:layout_height="wrap_content" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_column="4" 
      android:textSize="10sp" 
      android:textColor="@android:color/white" 
      android:text="Submitted"/> 
    </TableRow> 

</TableLayout> 

편집 2 분할 EDIT 사람 Texviews를 균등하게 배포하려고합니다. crete seekbar, here's 그것을 달성하는 모든 단계를 설명하는 멋진 자습서.

+0

예 시도해 보았지만 작동하지 않았습니다. –

+0

제 편집 된 답변을 확인하십시오 – dalla92

+0

선생님, 저는 이미 이것을 시도했습니다. 각 틱 (점) 표시 위에 텍스트를 표시하고 싶습니다. –

관련 문제