2017-12-26 17 views
0

私は以下のRelativeViewを持っています。私はここに問題がある - - 私は上に下 一部のビューはRelativeLayoutに表示されません

  • のTextViewで

    • のEditTextをしたい、それは表示されませんが、私は理解していない理由は、それらの間の
    • 2つのリストビュー - 画面の両方取って半分垂直方向

    トップのTextViewが表示されない理由はありますか?

    <?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:tools="http://schemas.android.com/tools" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 
        <EditText 
         android:id="@+id/Search" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:inputType="text" 
         android:layout_alignParentBottom="true"> 
         <requestFocus /> 
        </EditText> 
        <View android:id="@+id/Placeholder" 
         android:layout_height="0dp" 
         android:layout_width="0dp" 
         android:layout_above="@id/Search" 
         android:layout_centerInParent="true"/> 
        <ListView 
         android:id="@+id/ResultsColumn1" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_alignRight="@id/Placeholder" 
         android:layout_above="@id/Search" /> 
        <ListView 
         android:id="@+id/ResultsColumn2" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_alignLeft="@id/Placeholder" 
         android:layout_above="@id/Search"/> 
        <TextView 
         android:id="@+id/InformationTextTop" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_above="@id/ResultsColumn1" 
         android:text="Why is this not visible ?"/> 
    </RelativeLayout> 
    
  • 答えて

    1

    ListView sがandroid:layout_heightプロパティにmatch_parentを持っているとTextViewがXMLでそれらの後に定義されているので、それは単にです。これはかなりシンプルなレイアウトなので、代わりにLinearLayoutを使用することをお勧めします。

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:tools="http://schemas.android.com/tools" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical"> 
        <TextView 
         android:id="@+id/InformationTextTop" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_above="@id/ResultsColumn1" 
         android:text="Why is this not visible ?"/> 
    
        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="0dp" 
         android:layout_weight="1" 
         android:orientation="horizontal"> 
         <ListView 
          android:id="@+id/ResultsColumn1" 
          android:layout_width="0dp" 
          android:layout_height="match_parent" 
          android:layout_weight="1"/> 
         <ListView 
          android:id="@+id/ResultsColumn2" 
          android:layout_width="0dp" 
          android:layout_height="match_parent" 
          android:layout_weight="1"/> 
        </LinearLayout> 
    
        <EditText 
         android:id="@+id/Search" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:inputType="text"> 
         <requestFocus /> 
        </EditText> 
    </LinearLayout> 
    
    関連する問題