📄 Create a custom dialog in android Source Code by Java
public class CustomDialog extends Dialog implements View.OnClickListener {
public CustomDialog(@NonNull Context context) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE); // 다이얼로그의 타이틀바를 없애주는 옵션입니다.
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); // 다이얼로그의 배경을 투명으로 만듭니다.
setContentView(R.layout.here_layout_name); // 다이얼로그에서 사용할 레이아웃입니다.
}
}
final CustomDialog dialog = new CustomDialog(this);
WindowManager.LayoutParams mWindowManager = dialog.getWindow().getAttributes(); // Setting Dialog Width and Height.
mWindowManager.copyFrom(dialog.getWindow().getAttributes());
/* TODO: - Setting Dialog Width/Height Lines
final DisplayMetrics mDisplayMetrics = getApplicationContext().getResources().getDisplayMetrics(); // Get Device Display Size
final int width = mDisplayMetrics.widthPixels; // Device Display Width
final int height = mDisplayMetrics.heightPixels; // Device Display Height
mWindowManager.width = width / 2;
mWindowManager.height = height / 2;
*/
dialog.show();
🚀 REFERENCE
대화상자 | Android Developers
A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed. Dialog Design For…
developer.android.com
How to create a Custom Dialog box in android?
I want to create a custom dialog box like below I have tried the following things. I created a subclass of AlertDialog.Builder and used a custom Title and Custom Content View and used that but the
stackoverflow.com
Android Custom Dialog With Animation - Coding Demos
Learn how to create an Android custom dialog with left-right animation. You will build an Alertdialog with Imageview, background color, TextView and Button.
www.codingdemos.com
'#모바일 [Mobile] > Android' 카테고리의 다른 글
[Android] 백그라운드 투명색 설정 (Set transparent background of an imageview on Android) (0) | 2019.09.02 |
---|---|
[Android] 상태바 숨기기 (How to hide status bar?) (0) | 2019.09.02 |
[Android] ButterKnife Proguard 설정하기 (How to configure Proguard settings for ButterKnife?) (0) | 2019.08.01 |
[Android] AsyncTask (0) | 2019.07.25 |
[Android - OpenSource] Butter Knife (0) | 2019.07.25 |
댓글