1

내가 ... 무게와 레이아웃 다음과 미리보기에서 내 안드로이드 4 휴대 모든 것이 잘 작동에 대한 사용 예상대로안드로이드 - layout_weight를 안드로이드 2.3에 내 안드로이드 2.3.4에서 지금 ...

작동하지 않습니다 모바일, 3 개의 버튼과 회 전자를 보는 대신 정확히 1 1/2 버튼 만보고 나머지는 더 이상 화면에 표시되지 않습니다 ...

마지막 가중치를 1로 변경하면 모든보기가 a layout_weight 1, 그것은 또한 오래된 전화에서 작동합니다 ...

내가 뭘 잘못 했니? 트릭이 있습니까?

<com.actionbarsherlock.internal.widget.IcsLinearLayout 
    android:id="@+id/illBottom" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" > 

    <ImageButton 
     android:id="@+id/btSelectAll" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:background="@drawable/abs__item_background_holo_dark" 
     android:gravity="center" 
     android:onClick="onClick" 
     android:padding="4dip" 
     android:src="@drawable/holo_dark_content_select_all" /> 

    <ImageButton 
     android:id="@+id/btDeselectAll" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:background="@drawable/abs__item_background_holo_dark" 
     android:gravity="center" 
     android:onClick="onClick" 
     android:padding="4dip" 
     android:src="@drawable/holo_dark_custom_content_deselect_all" /> 

    <ImageButton 
     android:id="@+id/btDeleteSelected" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:background="@drawable/abs__item_background_holo_dark" 
     android:gravity="center" 
     android:onClick="onClick" 
     android:padding="4dip" 
     android:src="@drawable/holo_dark_content_discard" /> 

    <Spinner 
     android:id="@+id/spData" 
     style="@style/Widget.Sherlock.Spinner.DropDown.ActionBar" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="2" /> 
</com.actionbarsherlock.internal.widget.IcsLinearLayout> 
+0

ActionBarSherlock을 사용하고 있지만 'LinearLayout'의 방향을 가로로 설정할 수 있습니까? 일반적으로 방향을 지정하여 0dp로 지정한 매개 변수로 이동합니다. – Rarw

+0

당신 말이 맞아 ... 그냥 시도했지만 내 문제를 해결하지 못했습니다 – prom85

+0

왜 spinner에 layout_weight = "2"를 설정 했습니까? 일반적으로 다른보기보다 크게보기를 설정하려면 예 1의 합계를 취하는 것이 더 좋습니다. 따라서 다른보기의 값을 0.2로 설정하고 0.4를 설정하십시오. – Opiatefuchs

답변

1

대부분의 경우 당신은 모든 일에 걸쳐 선형 레이아웃을 추가하거나 이미 만들어진 COM을 사용 .... 그리고 안드로이드를 넣어해야합니다 layout_weightSum =

이 어떤 요소로이 넣어 "무엇이든 3" 이미지 버튼을 보유하고 있습니다.