2014-06-11 4 views
2

경고 대화 상자를 사용하여 사용자 정의보기를 표시하지만 경고 대화 상자가 매우 느리게 진행됩니다. 대략 10 ~ 15 초가 걸립니다. 여기에 내 코드가 잘못되었다.경고 대화 상자가 매우 느리게 표시됩니다.

LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      View vDialog = layoutInflater.inflate(R.layout.dialog, null); 
      AlertDialog.Builder builder = new AlertDialog.Builder(context); 
      builder.setView(vDialog); 
       AlertDialog ad = builder.create(); 
      ad.show(); 

여기 내 dialog.xml

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height ="match_parent" > 

<CalendarView 
    android:layout_width="50dp" 
    android:layout_height ="50dp">   
</CalendarView> 

</FrameLayout> 
+0

의 시스템 문제를 .... –

답변

0

이 코드를보십시오 :

final Dialog dialog = new Dialog(context, 
    android.R.style.Theme_Translucent_NoTitleBar); 
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
dialog.setContentView(R.layout.dialog); 
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); 
lp.copyFrom(dialog.getWindow().getAttributes()); 
lp.width = WindowManager.LayoutParams.MATCH_PARENT; 
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; 
lp.gravity = Gravity.CENTER; 

dialog.getWindow().setAttributes(lp); 

dialog.show(); 
0
// Try this way,hope this will help you to solve your problem. 

dialog.xml 
<CalendarView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height ="match_parent"/> 

Dialog dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar); 
dialog.setContentView(R.layout.dialog); 
dialog.show(); 
관련 문제