我怎么能证明有三个单选按钮的对话框? [英] How can I show the dialog that has three radio buttons?

查看:120
本文介绍了我怎么能证明有三个单选按钮的对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当点击OptionsMenu,我想证明中有3单选按钮对话框。结果
然后每3笔交易将取决于哪个选择被解雇。

When OptionsMenu is clicked, I want to show the dialog that has 3 radio buttons in it.
Then each of 3 transactions will be fired depending on which chosen.

我怎么能这样做?

我有2个OptionsMenu如关于选择

I have 2 OptionsMenu such as about and select

<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/about"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/about"/>

    <item
        android:id="@+id/select"
        android:orderInCategory="100"
        android:showAsAction="never"
        android:title="@string/select"/>

</menu>

我目前的code是这个

My current code is this

公共类MainActivity延伸活动{

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);

    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.about:
        new AlertDialog.Builder(this).setTitle("About").setMessage("Text about about").setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // continue with delete
            }
        }).show();
        break;
    case R.id.select:


    // What comes here?!?!?!?


    }
    return true;
}

}

推荐答案

下面是一些例子如何做到这一点。

Here are some examples how to do it.

您需要创建自己的自定义对话框来实现你想要的。

You need to create your own custom dialog to achieve what you want.

http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

安卓定制AlertDialog

http://overoid.tistory.com/29

这篇关于我怎么能证明有三个单选按钮的对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆