스마트폰앱

오늘:
2,539
어제:
2,589
전체:
2,707,438

고객센타 : 070-7752-2000
팩스 : 070-7752-2001
휴대폰 : 010-9513-0019
email : voipkorea@yahoo.co.kr

국민은행
(주)제이에스솔루션
047101-04-155519

Flag Counter
■ 무료 : 유선 집전화 휴대폰 ( 한국 미국 중국 카나다) ↔ (국내 해외 여행자 상사 주재원 유학생) / 가입무 무제한무료■

http://howrobotswork.wordpress.com/2013/08/16/creating-a-fullscreen-dialogfragment-with-a-custom-background/


Creating a fullscreen DialogFragment with a custom background

The default Dialogs (or rather the DialogFragments) look pretty good in Android since Honeycomb, but the Holo look-and-feel doesn’t go well together with all app designs. Not to mention sometimes you need a fully different layout, a custom background color, or a semitransparent background with no grey dimming at all. We’re talking about Android, where (almost) everything is possible, so there is a solution for this problem as well.

Customizing a DialogFragment is a quite easy task. Create a class extending DialogFragment, and override the onCreateDialog method, which is responsible for creating the Dialog. Instantiate a Dialog, then make the following calls on the instance:

  • requestWindowFeature(Window.FEATURE_NO_TITLE) – removes the dialog’s title
  • getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) forces the dialog to occupy the whole screen estate
  • setBackgroundDrawable() – sets the dimming drawable. This can be transparent, a solid color, a gradient or a custom drawable (even an image)
  • create the layout and set it to the dialog using setContentView()

These four steps give you an empty fullscreen layout to play with, with the option to add a semi-transparent background, revealing the underlying activity. From this point, only your imagination is the limit; a good example of what can be achieved is the following screen, taken from an upcoming app:

custom_dialogfragment

You can find more on using and customizing the DialogFragment at the official developer site. Here is a short sample code illustrating a DialogFragment with a yellow background and an empty layout.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class CustomDialogFragment extends DialogFragment {
 
    public CustomDialogFragment() {}
 
    @Override
    public Dialog onCreateDialog(final Bundle savedInstanceState) {
 
        // the content
        final RelativeLayout root = new RelativeLayout(getActivity());
        root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
 
        // creating the fullscreen dialog
        final Dialog dialog = new Dialog(getActivity());
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(root);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.YELLOW));
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
 
        return dialog;
    }
 
}
조회 수 :
9297
등록일 :
2014.02.09
18:19:09 (*.251.139.148)
엮인글 :
http://webs.co.kr/index.php?document_srl=38608&act=trackback&key=600
게시글 주소 :
http://webs.co.kr/index.php?document_srl=38608
List of Articles
번호 제목 글쓴이 날짜 조회 수
64 Sqlite detail easy tutorial. admin 2017-09-09 125
63 Change package name Linphone Android admin 2017-08-25 279
62 Liblinphone - import Linphone library in Android Studio 2017 admin 2017-08-25 271
61 I am able to build the limphone on mac by follow the steps describe here admin 2017-08-25 272
60 To build liblinphone for Android, you must COMPILATION INSTRUCTIONS admin 2017-08-25 261
59 sipdroid source code admin 2017-08-08 340
58 안드로이드 주소록 전체가져오기 이름만가져오기 사진가져오기 코드 admin 2015-04-13 5561
57 the sipdroid Research Miscellaneous admin 2015-03-26 2727
56 HSS070 English Korean 무료 국제전화 미국 중국 카나다 무료 통화 제공 admin 2014-12-28 3982
55 Softphones admin 2014-09-20 4435
54 /xxxxx/gen already exists but is not a source folder. Convert to a source folder or rename it. admin 2014-09-03 4845
53 CSIPSimple building Rebuilding Detail on Eclips Good All is heare perfect admin 2014-08-15 4791
52 Improving QoE of SIP-based Automated Voice Interaction in Mobile Networks file admin 2014-03-20 5602
51 speex support in android admin 2014-03-19 5821
50 voxmobile Source and how to build admin 2014-02-18 6187
49 PJSIP hung the phone constantly corrected the problem admin 2014-02-09 6636
48 Csipsimple code rebuilding source sip 통신 Call Mechanism admin 2014-02-09 18050
47 Csipsimple code rebuilding source sip 통신 technical interviewer admin 2014-02-09 6589
46 Csipsimple code rebuilding source 주요인터페이스분석 admin 2014-02-09 32011
45 Csipsimple code rebuilding source 다운로드 구성 csipsimple 소스 프로젝트 admin 2014-02-09 7659
44 Android DialogFragment Tutorial admin 2014-02-09 6884
» Creating a fullscreen DialogFragment with a custom background admin 2014-02-09 9297
42 [Android API] 네트워크 상태 체크하기 admin 2013-12-19 8228
41 [안드로이드] 네트워크 연결 상태 체크 함수. admin 2013-12-19 7578
40 안드로이드 인터넷연결체크 ( 3g/lte/wifi ) 메서드 admin 2013-12-19 13913
39 Android Get Phone Contacts details with Contact Image admin 2013-12-15 6904
38 안드로이드 커스텀 타이틀바 How to add custom title bar to android application admin 2013-10-02 9262
37 How to create a custom title bar admin 2013-07-15 9516
36 Rotary Dialer clip art admin 2013-04-20 17142
35 Java 프로그램 실행화일 만들기 : Launch4j admin 2013-02-21 10165
34 java network programming source code, learning socket programming admin 2012-12-04 10292
33 2X Client Configuration | Android Remote Desktop 안드로이드 PC 리모트 데스크탑 admin 2012-12-02 12063
32 WIFI 3G 인터넷 연결 실시간 체크 소스코드 Broadcast Receiver 사용 (Adnroid) admin 2012-10-31 16386
31 통신사별 와이파이 비밀번호 admin 2012-10-31 14348
30 팁, wifi 패스워드 모음집 password admin 2012-10-21 10648
29 Android User Session Management using Shared Preferences admin 2012-10-16 31968
28 Unicode Tables v4 admin 2012-10-16 22930
27 HTML Codes admin 2012-10-16 9622
26 IBM Scan Codes EBCDIC Codes admin 2012-10-16 11787
25 ASCII Table and Description admin 2012-10-16 11093
24 How to Show Alert Dialog in Android (간단하고 쉬운설명) admin 2012-10-15 22076
23 How to read contacts on Android 2.0 admin 2012-10-14 13125
22 WIFI 3G 인터넷 연결 체크 소스코드 직접 사용한 코드 android admin 2012-10-14 15050
21 Android Detect Internet Connection Status admin 2012-10-12 20593
20 JAVA + SSL (server and client examples) admin 2012-10-07 22147
19 Querying The Android Contact Database admin 2012-09-30 10505
18 Manage Contacts android admin 2012-09-30 12462
17 Android Contacts API 2 example admin 2012-09-30 13559
16 Android 2.0 주소록 동기화 기능 admin 2012-09-30 38695
15 안드로이드용 앱 개발 마켓등록 까지 해본거 샘플 무료국제전화 앱 FreeDialer admin 2012-09-27 14536
14 아이폰 IPhone 앱 개발 기본 admin 2012-09-27 11201
13 [안드로이드/개발] Intent admin 2012-09-23 17519
12 안드로이드 타이머 절적한 설명과 간단한소스코드 등 안드로이드 프로그램 설명 깔끔 admin 2012-09-23 28173
11 google voice source code admin 2012-09-22 10488
10 [안드로이드] 서버/클라이언트 소켓(Socket) 통신하기 admin 2012-09-20 20343
9 FreeDial 무료국제전화는 프리미엄 국제전화 다이렉트 회선사용 admin 2012-09-20 11582
8 Android SQlite 사용 admin 2012-09-04 11086
7 안드로이드마켓에 앱 등록하는 순서 admin 2012-08-19 41736
6 전화관련 안드로이드함수 admin 2012-08-18 15109
5 자바 ,이클립스,Android SDK, ADT 설치하여 무료국제전화 다이얼러를 만들어봅시다. admin 2012-08-06 15663
4 아이폰용 무료국제전화용 무료 다이얼러 Speedydialer 설치및 사용방법 file admin 2012-07-14 11000
3 접속번호 + 상대방번호 # 를 주소록에 전화번호로 저장하여 사용하면 편리하다 admin 2012-06-17 12971
2 App Store - ILD Dialer admin 2012-06-17 9539
1 한국휴대폰에서 미국 중국 카나다 무료 국제전화 서비스 admin 2012-04-27 9918