当前位置:网站首页>Summenudemo (submenu)
Summenudemo (submenu)
2022-07-27 19:52:00 【Ashurol】
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.main, menu);
getMenuInflater().inflate(R.menu.main, menu);
// SubMenu file = menu.addSubMenu(" file ");
// SubMenu edit = menu.addSubMenu(" edit ");
// file.add(1, 1, 1, " newly build ");
// file.add(1, 2, 1, " open ");
// file.add(1, 3, 1, " preservation ");
// file.setHeaderTitle(" File operations ");// Submenu Title
// file.setHeaderIcon(R.drawable.ic_launcher);// Submenu icon
// edit.add(2, 1, 1, " Copy ");
// edit.add(2, 2, 1, " Paste ");
// edit.add(2, 3, 1, " shear ");
// edit.setHeaderTitle(" Edit operation ");
// edit.setHeaderIcon(R.drawable.ic_launcher);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
// if(item.getGroupId()==1)
// {
// switch(item.getItemId())
// {case 1:
// Toast.makeText(this, " Click New ",Toast.LENGTH_SHORT).show();
// break;
// case 2:
// Toast.makeText(this, " Click to open ",Toast.LENGTH_SHORT).show();
// break;
// case 3:
// Toast.makeText(this, " Click save ",Toast.LENGTH_SHORT).show();
// break;}
// }else if(item.getGroupId()==2)
// {
// switch(item.getItemId())
// {case 1:
// Toast.makeText(this, " Click Copy ",Toast.LENGTH_SHORT).show();
// break;
// case 2:
// Toast.makeText(this, " Click Paste ",Toast.LENGTH_SHORT).show();
// break;
// case 3:
// Toast.makeText(this, " Click cut ",Toast.LENGTH_SHORT).show();
// break;}
// }
switch(item.getItemId())
{
case R.id.new_file:
Toast.makeText(this, " Click New ",Toast.LENGTH_SHORT).show();
break;
case R.id.open_file:
Toast.makeText(this, " Click to open ",Toast.LENGTH_SHORT).show();
break;
case R.id.save_file:
Toast.makeText(this, " Click save ",Toast.LENGTH_SHORT).show();
break;
case R.id.c_edit:
Toast.makeText(this, " Click Copy ",Toast.LENGTH_SHORT).show();
break;
case R.id.v_edit:
Toast.makeText(this, " Click Paste ",Toast.LENGTH_SHORT).show();
break;
case R.id.x_edit:
Toast.makeText(this, " Click cut ",Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
Menu In folder main.xml file <pre name="code" class="html"><menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.xin.zhicaidan.MainActivity"
>
<item
android:showAsAction="never"
android:title=" file ">
<menu>
<item
android:id="@+id/new_file"
android:showAsAction="never"
android:title=" newly build "/>
<item
android:id="@+id/open_file"
android:showAsAction="never"
android:title=" open "/>
<item
android:id="@+id/save_file"
android:showAsAction="never"
android:title=" preservation "/>
</menu>
</item>
<item
android:showAsAction="never"
android:title=" edit ">
<menu>
<item
android:id="@+id/c_edit"
android:showAsAction="never"
android:title=" Copy "/>
<item
android:id="@+id/v_edit"
android:showAsAction="never"
android:title=" Paste "/>
<item
android:id="@+id/x_edit"
android:showAsAction="never"
android:title=" shear "/>
</menu>
</item>
</menu>
边栏推荐
- 5W bonus pool / for colleges and universities, 2022 legal science and technology innovation competition is in progress
- 【深度学习基础知识 - 47】贝叶斯网络与朴素贝叶斯
- 【深度学习基础知识 - 43】优势比的概念
- OPPO发布首款AR眼镜,宣布未来3年投入500亿进行研发
- [basic knowledge of in-depth learning - 40] Why does CNN have more advantages than DNN in the field of images
- Application pool has been disabled
- ToggleButton(按钮开关)
- Unity-FairyGUI播放视频(Lua)
- [basic knowledge of deep learning - 43] concept of odds ratio
- ArrayAdapter(数组适配器)与SimpleAdapter(简单适配器)
猜你喜欢

【深度学习基础知识 - 46】贝叶斯定理与条件概率公式

jvisualvm的使用

Virtualbox:ssh connection
![[basic knowledge of deep learning - 43] concept of odds ratio](/img/74/d7d1562ada4671864961721b9a1baf.png)
[basic knowledge of deep learning - 43] concept of odds ratio

Intent(有无返回值得跳转)
![[basic knowledge of deep learning - 42] detailed explanation of logistic regression](/img/74/d7d1562ada4671864961721b9a1baf.png)
[basic knowledge of deep learning - 42] detailed explanation of logistic regression

JVM概述和内存管理(未完待续)

Fabric上搭建Hyperledger caliper进行性能测试

VS2017#include 'xxx.h'

AutoCompleteTextView(输入框预匹配)
随机推荐
rxbinding
英特尔发布Horse Ridge芯片:22nm工艺,能够控制多个量子位
注入攻击
ContextMenu (context menu)
Optimization of fixed number of cycles in embedded C language
Ericsson admitted bribery in China and other five countries and paid a fine of $1.06 billion to the United States
Matplotlib(基本用法)
5W bonus pool / for colleges and universities, 2022 legal science and technology innovation competition is in progress
【深度学习基础知识 - 39】BN、LN、WN的比较
二叉搜索树
【深度学习基础知识 - 44】逻辑回归实现多分类的方法
Remember an unprepared internship interview
Introduction to socke programming
pytorch tensor的基本函数
Embedded C language structure
SystemService(系统服务)
Detailed interpretation of IEC104 protocol (II) interaction process and protocol analysis
JS 寻找所有节点sibling childNodes children
发布自己的npm组件库
链表~~~