2012-03-08 6 views
1

저는 간단한 Android 서적을 쓰려고하는 새로운 Android 개발자입니다. 삭제 버튼을 선택하면 팝업창에 확인 메시지가 나타납니다. 그러나 팝업에 대한 배경은 없습니다. 필자는 동일한 부모 활동의 수신기에서 팝업을 작성했습니다.팝업에 대한 배경이 Android에 표시되지 않습니다.

enter image description here

protected void delPopup() { 
     // TODO Auto-generated method stub 
     LayoutInflater inflater = (LayoutInflater) DisplayContact.this 
       .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     View layout = inflater.inflate(R.layout.sure,(ViewGroup) findViewById(R.id.popup_element)); 
     yes_btn = (Button) layout.findViewById(R.id.buttonYes); 
     no_btn = (Button) layout.findViewById(R.id.buttonNo); 
     pw = new PopupWindow(layout, 300, 470, true); 
     pw.showAtLocation(layout, Gravity.CENTER, 0, 0); 

     prepareListeners(); 
     buttonClick(); 
     mOpenHelper = new DatabaseHelper(this); 

    }; 

및 xml 파일이

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/popup_element" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

및 텍스트보기처럼 간다,이 개 버튼 사람이 문제가 무엇 나를 인도 할 수 있습니까?

+0

여기서 u는 배경을 설정합니까? – Jayabal

답변

2

배경은 기본적으로 투명보십시오. 팝업을위한 배경을 설정해야합니다.

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/popup_element" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 

    android:background="#000000" 

    android:orientation="vertical" > 
0

팝업에서

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/popup_element" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 
관련 문제