Android系统如何创建自定义对话框/警报 [英] Android-How to create custom dialog/alert
本文介绍了Android系统如何创建自定义对话框/警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我有一个游戏关卡screen..when触摸的水平发挥我需要给指令警报/它弹出窗口(scrolable)。
HI I have a game level screen..when touch a level to play I need to give instruction alert/popup window(scrolable) for it.
这应该是愤怒鸟customized..likes弹出。
It should be customized..likes popup in angry-bird..
自己的背景图片
无国界
只有ok键
own background image no borders with only ok button
请帮我我将要发布这GOOGLEPLAY ...
Please help me Im about to publish this to GOOGLEPLAY...
推荐答案
我认为你需要code这里是一个
i think you need code here is the one
mydialog.xml
<?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="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok"
android:layout_gravity="center"
/>
</LinearLayout>
Dialog dialog=new Dialog(mContext);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.mydialog);
dialog.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialogbackground);
Button mOkButton=(Button)dialog.findViewById(R.id.ok);
mOkButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//do here what you want to do with ok button click
}
});
这里 dialogbackground
是背景图片
Here dialogbackground
is the background image
这篇关于Android系统如何创建自定义对话框/警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文