2013-09-22 4 views
1

"저장"및 "첨부 그림"버튼을 내 xml 페이지의 맨 위에 맞추려고하는데 제대로 작동하지 않습니다. 단추가 같은 수평선에 정렬되지 않는 지점까지 가져 왔습니다. 아, 그리고 두 단추를 왼쪽 상단과 오른쪽 상단 모서리에 정렬시킬 수있는 방법이 있습니까?같은 수평선에 두 개의 버튼이 있습니다

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:fillViewport="true"> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#ffffff" > 

    <!-- Footer Start --> 

    <LinearLayout 
     android:id="@+id/footer" 
     android:layout_width="fill_parent" 
     android:layout_height="90dip" 
     android:layout_alignParentBottom="true" 
     android:background="@layout/footer_repeat" 
     android:orientation="horizontal" > 
    </LinearLayout> 
    <!-- Footer Ends --> 


    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:padding="10dip" > 

     <!-- Save button --> 

     <Button 
      android:id="@+id/btnSavePic" 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginTop="10dip" 
      android:text="@string/savePic" 
      android:layout_gravity="top|left"/> 

     <Button 
      android:id="@+id/btnAttachPic" 
      style="?android:attr/buttonStyleSmall" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginTop="10dip" 
      android:text="@string/attachPic" 
      android:layout_gravity="top|right"/> 
    </LinearLayout> 



</RelativeLayout> 

</ScrollView> 

추가 사진 : http://tinypic.com/view.php?pic=4ihut4&s=5#.Uj9eHBbnZAh

답변

4

은 내가 eclosing에있는 LinearLayout을 사용하는 것이 좋습니다 것입니다 :

<LinearLayout 
    android:id="@+id/linear_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    > 


    <Button 
     android:id="@+id/btnSavePic"  
     android:layout_width="0dip" 
     android:layout_weight="1" 
     android:layout_height="wrap_content"  
     android:text="@string/savePic" 
     /> 

    <Button 
     android:id="@+id/btnAttachPic" 
     android:layout_width="0dip" 
     android:layout_weight="1" 
     android:layout_height="wrap_content"  
     android:text="@string/attachPic" 
     /> 
</LinearLayout> 
-1

이 시도 다음은 XML 페이지입니다. 희망이 작동합니다. 방향을 에서 가로로 변경하여 단추를 가로 방향으로 정렬 할 수 있습니다.

투표가 작동하면 투표하십시오.

관련 문제