2012-09-17 4 views
0

화면 아래쪽에 5 개의 버튼이 있습니다 (선형 레이아웃으로 그룹화, 각각 1의 무게, 스크린 샷에서 b1-b5 위의 행). 그러나 텍스트가 둘 이상의 행이면 해당 특정 단추는 부모 외부에서도 푸시됩니다. 각 버튼의 높이는 모든 버튼과 동일한 설정 값입니다. next > 단추가 올바른 위치에있는 유일한 단추입니다. 일부 XML 아래, 그러나 그것은 나에게 보통의 모든 것 : 버튼의 B1-B5에서안드로이드 버튼이 텍스트가 맞지 않을 때 눌려 졌음

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/h" 
    android:orientation="horizontal" > 

    <Button         } 
     android:layout_width="0dp"    } 
     android:layout_height="@dimen/h"  } x5 
     android:layout_weight="1"/>   } 
</LinearLayout> 

있는 LinearLayout는 10dp의 margin_top있다.

의 스크린 샷 : 버튼이 정렬해야하는 위치

screenshot http://imageshack.us/a/img441/2878/device20120917163138.png

레드 라인입니다. 파란색 선은 두 줄의 텍스트 (녹색 3)가있는 버튼입니다.

스크린 샷에 따르면 버튼은 포함 된 텍스트의 줄이 조금 더 많이 아래로 밀려납니다. 단추에 텍스트가 너무 많이 포함되어 있으면 단추가 눌리지 않게하려면 어떻게합니까? android:baselineAligned="false" : (단축 있지만) 전체이 값을 설정, XML에서 XML

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="0dp" 
    android:paddingLeft="6dp" 
    android:paddingRight="6dp" 
    android:paddingTop="6dp"> 
    <LinearLayout 
     android:id="@+id/panel1" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/h" 
     android:layout_alignParentBottom="true" 
     android:layout_marginTop="@dimen/margin" 
     android:layout_centerHorizontal="true"> 
     <Button 
      android:layout_width="0dp"  } 
      android:layout_height="@dimen/h" }x5 
      android:layout_weight="1"/>  } 
    </LinearLayout> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_above="@+id/text" 
     android:layout_alignParentTop="true"> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="vertical" 
      android:background="@color/black" 
      android:textColor="@color/white" 
      android:text="@string/longtext"> 
     </TextView> 
    </ScrollView> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@id/panel1" 
     android:gravity="bottom"> 

     <LinearLayout 
      android:id="@+id/panel2" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/h" 
      android:orientation="horizontal"> 

      <Button 
       android:layout_width="0dp"    } 
       android:layout_height="@dimen/h" }x5 
       android:layout_weight="1"/>    } 
     </LinearLayout> 
    </RelativeLayout> 
</RelativeLayout> 
+0

레이아웃 파일을 제공하십시오 – DroidBender

답변

1

: 나는 그들을 동등하게

편집을 가중 필요하기 때문에 I는 RelativeLayout의를 사용하고 그들에게 alignTop을 가질 수 없습니다. Strangly 이것은 당신이 기대하는 것과는 정반대입니다.

+0

감사합니다. – stealthjong

관련 문제