2013-02-28 5 views
0

현재 안드로이드 애플 리케이션의 GUI 내에서 특정 요소를 정렬하는 방법을 찾으려고합니다. 아래 이미지 링크를 참조하십시오, 첫 번째 레이아웃은 현재 하나이며 두 번째는 내가 목표로하는 것입니다. 현재 두 개의 선형 레이아웃을 사용하고 있습니다. 오른손 버튼과 EditText에 대한 상대 및 테이블 레이아웃을 사용하려고 시도했지만 항상 EditText가 축소되거나 태블릿의 화면 크기를 오버플로합니다.안드로이드 GUI 레이아웃

도움 주셔서 감사합니다.

이미지 링크 : (http://postimage.org/image/pptkdkomx/)

답변

1

이 시도 :

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

<ImageView 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="0.5" /> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="0.5" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" android:text="Button1"/> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" android:text="Button2"/> 
    </LinearLayout> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</LinearLayout> 

</LinearLayout> 
0

가 왜 RelativeLayout을 사용하고 EditText 사용을하지 않는 android:layout_alignBottom="myImage"

0

그냥 함께 빠른 템플릿을 가져, 당신은 할 수있다 내가 메모장 만 사용 했으므로 직접 수정하고 속성을 추가해야합니다.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <ImageView 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="50"/> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="50"> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <Button android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="50"/> 

      <Button android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="50"/> 

     </LinearLayout> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 

    </LinearLayout> 

</LinearLayout>