2010-05-16 2 views
2

테이블 행에 TextView와 ToggleButton을 넣으려고합니다. 그러나 정렬하지 않는 것 같습니다 (버튼 상단은 약 10px에서 시작됩니다. 각 요소가 같은 경우에도 높이 불구하고 텍스트 뷰의 맨 아래 것은. 사람.Android 레이아웃 : TextView와 ToggleButton이 일치하지 않는 이유

<TableLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 

     > 
    <TableRow> 
     <AutoCompleteTextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:singleLine="true" 
     android:layout_weight="1" 
     /> 

     <ToggleButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     /> 
     </TableRow> 

     </TableLayout> 

답변

2

TableRow가있는 LinearLayout처럼 동작 기본적으로 자신의 기준에 따라 텍스트 위젯을 정렬하려고 왜? 말해 android:layout_gravity="center_vertical"를 설정 (또는 수 다른 중력 설정)을 ToggleButton에 적용 할 수 있습니다.

관련 문제