2011-01-11 7 views
0

Relativelayout에서 6 개의 textviews, 3 개의 editboxes 및 2 개의 스피너가 있습니다. 앱에서 editboxes를 추가하려고합니다. 그러나 앱은 추가 상자를 표시하지 않습니다.상대 레이아웃 Android

내 코드는 다음과 같습니다

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scrollview" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

    <RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"> 


    <TextView 
     android:id="@+id/EditText01" 
     android:text="@string/type1" 
     android:layout_alignParentLeft="true" 
     android:layout_width="fill_parent" 
     android:textSize="18sp" 
     android:layout_toLeftOf="@+id/Button01" 
     android:layout_height="wrap_content"></TextView> 
    <EditText 
     android:id="@+id/Button01" 
     android:layout_width="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_height="wrap_content"></EditText> 

     <TextView 
     android:id="@+id/EditText02" 
     android:text="@string/type2" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@id/EditText01" 
     android:layout_width="fill_parent" 
     android:textSize="18sp" 
     android:layout_toLeftOf="@+id/Button01" 
     android:layout_height="wrap_content"></TextView> 
    <EditText 
     android:id="@+id/Button02" 
     android:layout_width="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@id/Button01" 
     android:layout_height="wrap_content"></EditText> 

    <TextView 
     android:id="@+id/EditText03" 
     android:text="@string/type3" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@id/EditText02" 
     android:layout_width="fill_parent" 
     android:textSize="18sp" 
     android:layout_toLeftOf="@+id/Button01" 
     android:layout_height="wrap_content"></TextView> 
    <EditText 
     android:id="@+id/Button03" 
     android:layout_width="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@id/Button02" 
     android:layout_height="wrap_content"></EditText>  

     <TextView 
     android:id="@+id/EditText04" 
     android:text="@string/property" 
     android:layout_below="@id/EditText03" 
     android:layout_width="fill_parent" 
     android:textSize="18sp" 
     android:layout_height="wrap_content"></TextView>  
     <Spinner 
     android:id="@+id/spinner" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/Button03" 
     android:prompt="@string/property"></Spinner> 

     <TextView 
      android:id="@+id/EditText05" 
      android:text="@string/propage" 
      android:layout_below="@id/spinner" 
      android:layout_width="fill_parent" 
      android:textSize="18sp" 
      android:layout_height="wrap_content"></TextView> 
     <Spinner 
      android:id="@+id/widget" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/EditText05" 
      android:prompt="@string/propage"></Spinner> 

      <TextView 
      android:id="@+id/EditText06" 
      android:text="@string/income" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/widget" 
      android:layout_width="fill_parent" 
      android:textSize="18sp" 
      android:layout_toLeftOf="@+id/Button04" 
      android:layout_height="wrap_content"></TextView> 
     <EditText 
      android:id="@+id/Button04" 
      android:layout_width="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_height="wrap_content"></EditText> 



    </RelativeLayout> 

</ScrollView> 

마지막 편집 상자 또는 첨가 요소가 응용 프로그램에 표시되지 않습니다.

도와주세요.

+0

이걸 실행할 때 오류가 있습니까? 아니면 그들은 나타나지 않습니다. – ataulm

답변

1

정확하고 완전한 XML 파일 콘텐츠를 업데이트 할 수 있습니까?

또한 GUI 디자이너의 관점에서 볼 때 이러한 많은 컨트롤은 제한된 디스플레이에서만 잔인하다고 생각합니다. ScrollView을 사용했지만 GUI 디자인을 다시 생각해 보시기 바랍니다. 마지막 글고 치기에 대해 이상한 나를 공격

+0

+1 ScrollView (매우 큰 장치가없는 경우) – ataulm

0

것들 :

  • 이 버튼으로 신원입니다. Button을 버튼으로 사용하는 것이 좋습니다.
  • 프로그래밍 방식으로 설정하지 않는 한 내용이 없습니다. 따라서 wrap_content 너비는 0입니다 (보이지 않습니다).
  • 이것은 RelativeLayout에 속하지만, 다른 어떤 요소가 에 배치되어야한다고 말하지 않았습니다. 기본적으로는 요소가 겹쳐서 맨 위에 표시됩니다. 그러나 너비가 0이므로 도 볼 수는 없습니다.

희망이 도움이됩니다. RelativeLayout에 죽음. (별로 유용하지 않지만 유용합니다.)

1

실제로 보이고 있지만 이전 편집 상자가 겹칠 수 있습니다. 테스트로서 모든 @ 스트링을 문자열로 순차적 인 숫자로 대체하고 코드 끝 부분에 추가 편집 상자를 추가 했으므로 레이아웃에 나타나지만 마지막 부분과 겹칩니다. 테스트와 똑같은 일을 시도하면 내 뜻을 알 수 있습니다. 그것이 당신을 위해 잘되기를 바랍니다.

건배,