다이얼로그를 기본 다이얼로그 형태가 아닌 커스텀 다이얼 로그를 개발중 구현해야할 필요가 생겨서 구현 해보았습니다.
하다보니 빠른 속도 하며 여러 장점이 있는것 같네요
- 이미지가 들어간 xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:gravity="center"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/group_pop_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/dataloading_popup_loading"
android:layout_marginBottom="100dip">
</LinearLayout>
</LinearLayout>
- java 파일
- 오픈 할경우
public void showPopUp(Context context){
try{
this.mContext = context ;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(mContext.LAYOUT_INFLATER_SERVICE);
final View groupPopView = inflater.inflate(R.layout.data_loading , null);
mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar);
mDialog.addContentView(groupPopView, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
mDialog.show();
}catch (Exception e){
}
}
- 닫을 경우
public void hidePopUp(){
try{
mDialog.hide();
}catch (Exception e){
mDialog.dismiss();
}
}