Android layout 相对布局

Android layout 相对布局,android-layout,Android Layout,我在Relativelayout中有6个文本视图、3个编辑框和两个微调器。我正在尝试在应用程序中添加更多的编辑框。但该应用程序没有显示额外的框 我的代码是: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview" android:layout_

我在Relativelayout中有6个文本视图、3个编辑框和两个微调器。我正在尝试在应用程序中添加更多的编辑框。但该应用程序没有显示额外的框

我的代码是:

<?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>  

最后一个编辑框或任何进一步添加的元素未显示在应用程序中


请帮助。

您能更新正确完整的xml文件内容吗


另外,从GUI设计师的角度来看,我认为这些控件在有限的显示上是非常糟糕的。虽然您使用了
滚动视图
,但我建议您重新思考GUI设计。

上一篇编辑文本中让我感到奇怪的事情:

  • 它的ID是一个按钮。如果使用按钮,请考虑使用<代码>按钮>代码>
  • 它没有内容,除非以编程方式设置。所以
    wrap\u内容
    在“宽度”上,它的宽度为0(因此不可见)
  • 它在一个
    RelativeLayout
    中,但是您没有说它应该是哪个其他元素 相对于被放置。我认为默认情况是它会重叠 元素,从顶部开始。但是因为它的宽度是0, 在那里你甚至看不到它

希望这有帮助。死亡是相对的。(不太有用,但我讨厌它)。

我认为它们实际上是在显示,但它们可能与以前的编辑框重叠。作为测试,我将所有@字符串替换为序列号作为字符串,并在代码末尾添加了一个额外的编辑框,它确实出现在布局中,但与最后一个重叠。试着做与测试相同的事情,你就会明白我的意思。希望你一切顺利


干杯,

运行此操作时是否出现错误?或者他们就是不出现?