0
팝업을 보이지 않게 만드는 문제가 있습니다. 내가 보이기 위해 그것을 누르면 표시되지만 취소 단추 (Cance 단추는 팝업에 있음)를 누르면 표시되지 않고 코드를 통해 정상적으로 전달되며 아무 것도 표시되지 않습니다.팝업이 보이지 않지만 코드를 통과하고 아무 일도 일어나지 않습니다.
final PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.popup,
null, false), 300, 300, true);
View layout = inflater.inflate(R.layout.popup,
(ViewGroup) findViewById(R.id.llPopup));
Button btnOK = (Button) layout.findViewById(R.id.btnOK);
Button btnCancel = (Button) layout.findViewById(R.id.btnCancel);
btnCancel.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (pw != null) {
pw.dismiss();
}
}
});
이 popup.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#AAAAAAAA"
android:id="@+id/llPopup"
>
<LinearLayout
android:orientation="horizontal"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/txtSearchBy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Search By:"
/>
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="vertical">
<RadioButton
android:id="@+id/rbPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time" />
<RadioButton
android:id="@+id/rbDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Price" />
<RadioButton
android:id="@+id/rbLongitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Longitude" />
</RadioGroup>
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<Button
android:id="@+id/btnCancel"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
/>
<Button
android:id="@+id/btnOK"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:text="OK"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
</LinearLayout>
무엇 나는 누군가가 나를 도울 수 잘못 할?
@Christian Thanks, works now !!! – Damir