我怎么能证明有三个单选按钮的对话框?
问题描述:
当点击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