2013-03-16 4 views
0

난`다음 레이아웃을 만들려고 : SeekBar를 올바르게 표시하는 방법은 무엇입니까? (layout_weight를)

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

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
    </TextView> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
    </TextView> 

    <SeekBar 
     android:id="@+id/seekbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 
    </TextView> 

</LinearLayout> 

에서, textView1 및 textView2에 부모 레이아웃의 80 %를 제공하고자 최대한 SeekBar를 포장 I`d 및 나머지 여유 공간은 textView3에 부여됩니다.

I`ve가 시도 : 속성에 layout_weight

  • 사용 (각각 - 4, 4, 1, 1) 그러나 마지막 보기는
  • 사용 레이아웃 무게 만 textView1와 textView2와 SeekBar를 겹쳐 SeekBar의 높이를 "wrap_content"로 설정하고 마지막보기에 "match_parent"를 설정하십시오.

이제 더 이상 아이디어가 없습니다. 그런 문제가 있습니까?

답변

0

아니라 내가 시도 할 것이 레이아웃을 만들 수 있습니다 : 너와 크기를 조정 무게에

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="match_parent" 
    android:layout_height="0dip" 
    android:layout_weight="4" > 
</TextView> 

<TextView 
    android:id="@+id/textView2" 
    android:layout_width="match_parent" 
    android:layout_height="0dip" 
    android:layout_weight="4" > 
</TextView> 

<SeekBar 
    android:id="@+id/seekbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 

<TextView 
    android:id="@+id/textView3" 
    android:layout_width="match_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1"> 
</TextView> 

메이크업의 변화를. 검색 막대가 콘텐츠를 감싸고 다른보기에 가중치를 부여합니다.

도움이되는지 알려주세요.

+0

좋아요! 고맙습니다! 그것은 완벽하게 작동합니다. 하지만 ... 왜 효과가 있는지 말해 줄 수 있어요? SeekBar의 공간이 처음 결정됩니다 (할당 된 체중이 없기 때문에)? 나머지는 가중치에 따라 나누어집니다. – ppablo28

관련 문제