Activity로 Dialog Popup 만들기 :: 안드로이드 설치 및 개발[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

안드로이드 설치 및 개발
[1]
등록일:2018-09-11 09:25:16 (0%)
작성자:
제목:Activity로 Dialog Popup 만들기

Activity Class를 만든다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class cGameStartPopup extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        WindowManager.LayoutParams  layoutParams = new WindowManager.LayoutParams();
        layoutParams.flags  = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
        layoutParams.dimAmount  = 0.7f;
        getWindow().setAttributes(layoutParams);
        setContentView(R.layout.activity_game_start_popup);
        getWindow().getAttributes().width   = (int)(cGameManager.getInstance().getDisplayMetrics().widthPixels * 0.9);
        getWindow().getAttributes().height  = (int)(cGameManager.getInstance().getDisplayMetrics().heightPixels * 0.4);
    }
}
cs


7 : 타이틀 바 제거.

8 ~ 11 : 팝업창이 뜨면 뒷배경을 블러처리 해준다.

13~14 : 팝업창이 모바일 디스플레이에 맞게 크기를 재설정 한다.


Activity Layout 생성.

1
2
3
4
5
6
7
8
9
10
11
12
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center">
 
    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/imageView"
        android:background="@drawable/game_start_popup" />
</RelativeLayout>
cs


AndroidMenifest에 Activity 등록

1
2
3
4
5
6
<!-- 게임스타트 팝업 엑티비티 -->
<activity
    android:name=".Popup.cGameStartPopup"
    android:theme="@android:style/Theme.Dialog"
    android:screenOrientation="portrait">
</activity>
cs



Main Activity에서 Popup Activity 실행 방법

1
startActivity(new Intent(this, cGameStartPopup.class));
cs





[본문링크] Activity로 Dialog Popup 만들기
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=34820
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.