2016-06-17 5 views
0

wrap_content의 너비와 높이로 RelativeLayout이 간단합니다. 그러나 그것을 포장하지 않습니다. 어쩌면 나는 뭔가를 놓친다.대화 상자 창에 내용이 없습니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@color/Wheat"> 

    <LinearLayout 
     android:id="@+id/btn_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_alignParentBottom="true" 
     android:background="@android:color/black"> 

     <Button 
      android:id="@+id/saveNewBtn" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:onClick="saveData" 
      android:text="Save" /> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:onClick="cancelAction" 
      android:text="Cancel" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:id="@+id/linearlayout" 
     android:orientation="vertical"> 
    </LinearLayout> 


</RelativeLayout> 

초 동안 스크린 샷으로 업데이트됩니다.

application screenshot

답변

1

이 시도 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout  
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@color/Wheat"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:id="@+id/linearlayout" 
    android:orientation="vertical"> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/btn_layout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:layout_below="@id/linearlayout" 
    android:background="@android:color/black"> 
    <Button 
     android:id="@+id/saveNewBtn" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:onClick="saveData" 
     android:text="Save" /> 

    <Button 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:onClick="cancelAction" 
     android:text="Cancel" /> 
</LinearLayout> 

</RelativeLayout> 

나는 안드로이드를 제거 : layout_alignParentBottom="true" bin_layout에서 대신 설정 : 물론 :)는 그리 명확의 android: layout_below="@id/linearlayout

+0

PFF ... ... Duh ... 건배! – Martynas

+0

@Martynas 문제 없으므로 작동하는데 도움이됩니다.) – REG1

관련 문제