0
간단한 사용자 정의 대화 상자를 표시하고 싶습니다. 처음에는 텍스트보기를 추가하고 대화 상자가 표시되는지 확인하기 만했습니다. 사용자가 (나) (가) 나는이 코드를 사용하여 메뉴 항목을 누르면Android 사용자 정의 대화 상자가 표시되지 않습니다.
@Override
protected Dialog onCreateDialog(int id) {
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.predialog);
dialog.setTitle("Tests of my Dialog");
return dialog;
}
: 이것은이 onCreateDialog 기능에 대한 내 코드입니다
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/tvPreview"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/Instructions"></TextView>
</LinearLayout>
:
이
내 XML입니다public void DiagTests(){
showDialog(0);
}
화면이 흐릿하지만 대화 상자가 표시되지 않는 경우가 발생합니다.
내가 뭘 잘못하고 있는지 알 수있는 사람이 있습니까?
경찰 : 어떤 종류의 오류나 경고가없는 경우를 대비하여. 어떤 도움
실제로 작동하도록했습니다. 그러나 그것은 이상했다. 이 사용자 정의 대화 상자를 테스트하기 위해 완전히 새로운 프로젝트를 만들었고 XML을 처음부터 다시 만들지 않았기 때문에 첫 번째 시도에서 작동했습니다. 그래서 내가 한 일은 xml을 처음부터 생성하고 작동했습니다. 도와 주셔서 감사합니다. 그것이 무엇이 잘못되었는지를 아는 것은 매우 흥미롭지 만 ... – aarelovich