2017-12-26 16 views
0

다음의 RelativeView가 있습니다. 내가 여기에 문제가있는 - - 나는 정상에 바닥 일부보기가 RelativeLayout에 표시되지 않습니다.

  • 텍스트 뷰에서

    • 글고 치기를 원하는가 표시되지 않습니다하지만 난 이해가 안 돼요 왜 그들 사이
    • 2 개의 ListView - 화면을 모두 복용 반 수직

    톱 텍스트 뷰가 표시되지 않는 이유는 무엇입니까?

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