我实现了一个Android应用程序.我想在评级按钮点击时调用或弹出片段.
例如,这里我附上了截图.当我点击率按钮时,如何调用这样的弹出窗口或片段
请帮我怎么称这些片段?
您需要设计另一个布局,仅用于显示弹出窗口并使其成为alignparenttop.这是示例布局
创建新的xml文件dialog.xml
一旦你创建了你的设计.你需要在你的onbutton点击中调用它.以下是显示对话的示例
ratingButton.setOnCLickListener(new view.OnCLickListener(){ @Override public void onCLick(View v){ final Dialog fbDialogue = new Dialog(ProfileActivity.this, android.R.style.Theme_Black_NoTitleBar); fbDialogue.getWindow().setBackgroundDrawable(new ColorDrawable(Color.argb(100, 0, 0, 0))); fbDialogue.setContentView(R.layout.facebook_dialogue); fbDialogue.setCancelable(true); fbDialogue.show(); } }); Hey I have put the code in onclicklistener. Check it . The above code works perfectly fine for me. As per my requirement I wanted the dialogue on the bottom of the screen . I have just made few lines of code change above to meet your requirement. My requirement was something like this