2012-05-10 4 views
5

PopupWindow이 표시 될 때 배경을 더 어둡게하고 싶습니다. 돌핀 브라우저는 PopupWindow팝업이 표시 될 때 배경색 변경

And now see the background color after the PopupWindow is shown.

후 PopupWindow

Look at the background color before the PopupWindow is shown

전에

로 삼았 않는 것처럼 배경색은 무엇보다 어두운이다. 그럼 어떻게 할 수 있니? 내가하지 틀렸다 경우

답변

0

... 당신은 목록보기와 활동을 만들고 ....와 같은 매니페스트 대화로 테마를 넣을 수 있습니다 ..

<activity android:theme="@android:style/Theme.Dialog" /> 

이 배경 어둡게 만들 것입니다.

+0

오케이하지만 ... 코드를 변경하고'PopupWindow'를 활동으로 만드는 이유는 무엇입니까? – Rajkiran

+1

당신의 팝업은 자신의 배경을 가질 것입니다 ..... 왜냐하면 기본적으로 어두워서 ... 필요한 효과를냅니다 .. – 5hssba

+0

동의하지만 PopupWindow 컨트롤이있을 때 활동을 호출하는 이유는 무엇입니까? 너와 함께. 어쨌든, 아무 것도 작동하지 않으면, 나는이 해결책을 가지고 갈 것이다. – Rajkiran

0

팝업이 인 경우이 코드를 사용해보십시오. 그러면 분명히 도움이 될 것입니다. 프로젝트의 값 폴더에 mystyle.xml 파일을 만들고이 내용을 변경하십시오.

<resources> 
    <style name="customStyle" parent="@android:style/Theme.Dialog"> 
    <item name="android:windowBackground">@android:color/transparent</item> 
    </style> 
</resources> 

은 'match_parent'로 폭과 높이가 같은 것을 추가하여 XML 파일에 menifest.xml

<activity android:name="yourActivity" android:theme="@style/customStyle"></activity> 
+0

위에서 언급 한 것처럼, 나는'PopupWindow' 컨트롤을 사용하고'Activity'는 사용하지 않습니다. – Rajkiran

3

에서이 변경을한다. 활동에

<RelativeLayout 
     android:id="@+id/bac_dim_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#C0000000" 
     android:visibility="gone" > 
</RelativeLayout> 

는 한 OnCreate

//setting background dim when showing popup 
back_dim_layout = (RelativeLayout) findViewById(R.id.bac_dim_layout); 

마지막으로 당신이 당신의 popupwindow를 표시 할 때 볼 수 있도록하고 popupwindow를 종료 할 때 그 볼이 사라합니다.

back_dim_layout.setVisibility(View.Visible); 
back_dim_layout.setVisibility(View.GONE);