android studio布局无法点击,Android Studio菜单项单击不起作用
因此,我的菜单项除了单击时会显示放大的动画外,什么也不会做.我正在尝试与他们开展一项新活动,我敬酒意味是否可以做什么,但我一无所获.这是常见问题吗?
minSdkVersion 17
targetSdkVersion 27
布局
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
该布局正在使用android.support.constraint.ConstraintLayout
菜单
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
android:id="@+id/navigation_home"
android:icon="@drawable/home"
android:title="@string/title_home" />
android:id="@+id/navigation_apps"
android:icon="@drawable/apps"
android:title="@string/title_apps" />
android:id="@+id/navigation_profile"
android:icon="@drawable/profile"
android:title="@string/title_profile" />
android:id="@+id/navigation_logout"
android:icon="@drawable/logout"
android:title="@string/title_logout" />
Java的
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.navigation, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.navigation_home) {
Intent navHome = new Intent(this, WordPressActivity.class);
this.startActivity(navHome);
return true;
}
if (id == R.id.navigation_apps) {
Toast.makeText(this, "apps is Clicked", Toast.LENGTH_LONG).show();
return true;
}
if (id == R.id.navigation_profile) {
Intent navProf = new Intent(this, AccountActivity.class);
this.startActivity(navProf);
return true;
}
if (id == R.id.navigation_logout) {
Intent navLog = new Intent(this, LogoutActivity.class);
this.startActivity(navLog);
return true;
}
return super.onOptionsItemSelected(item);
}
预先感谢您对问题的任何帮助或指示.我对使用菜单项“点击意图”是陌生的,我真的不明白为什么它不起作用.
android studio布局无法点击,Android Studio菜单项单击不起作用相关推荐
- android togglebutton多次点击,Android ToggleButton使用笔记
1.什么是ToggleButton? android.widget.ToggleButton--->android.widget.CompoundButton--->android.wid ...
- android 置灰不可点击,Android Studio 运行按钮灰色的完美解决方法
Android Studio 运行按钮灰色的完美解决方法 今天新建项目的时候突然发现编译后运行按钮为灰色. 解决方案:第一步:点击图中的Add Configuration,出来如下界面 第二步:点+号 ...
- android 将布局多次添加,android – 如何在布局xml中添加循环视图
您无法将aar文件添加到Eclipse中的libs文件夹(它不是jar文件) 目前,使用新的RecyclerView的最佳方式是切换到Android Studio并将此依赖项添加到build.grad ...
- android表格布局最后一个组件,Android布局之TableLayout表格布局
Tablelayout类以行和列的形式对控件进行管理,每一行为一个TableRow对象,或一个View控件.当为TableRow对象时,可在TableRow下添加子控件,默认情况下,每个子控件占据一列 ...
- android表格布局的使用方法,Android布局(RelativeLayout、TableLayout等)使用方法
本文介绍 Android 界面开发中最基本的四种布局LinearLayout.RelativeLayout.FrameLayout.TableLayout 的使用方法及这四种布局中常用的属性.Line ...
- android设置图片不可点击,Android 点击图片设置相关的响应事件
实现相关的接口: implements View.OnTouchListener 实现相关函数: public boolean onTouch(View view, MotionEvent motio ...
- android图片布局填冲满,Android图片裁剪库——cropper使用,完美解决图片填充不满布局问题...
前些时间请了一个月假,远程办公,期间项目主要做图片裁剪,脑子里第一反应就是github上开源裁剪库,试了排名的前几个,其中不是UI定制度太低就是裁剪效果不怎么样.当然你也可以直接intent一下系统的 ...
- Android layout布局属性、标签属性总结大全
RelativeLayout 第一类:属性值为true可false android:layout_centerHrizontal 水平居中 android:layout_centerVe ...
- Android的布局
对于Android的布局,下面的一个例子可以很好的说明Android的布局的特性和Android的xml的设置. 首先是layout中的xml文件的各个函数的内容: android:idà为控件指定相 ...
最新文章
- Faster RCNN网络简介
- 升级Hbase,解决bug问题
- 【ArcGIS遇上Python】三种利用Python批量处理地理数据的方法——以栅格数据投影转换为例
- Repeater的使用
- 拒绝无脑试错:写给萌新的“科学炼丹”入门手册
- 中文字体其实也可以用在网页上的
- 小程序之旅——第四站(模板框架)
- python 实现手机自动拨打电话(循环通话测试)
- 多台电脑之间共享键盘鼠标
- Linux Thermal机制源码分析之Thermal zone
- java io 系列(转载skywang12345)
- 谁不想拥有自己的代码仓库?
- mysql启动集群报连接本地失败_Docker的mysql集群节点可以正常创建,但无法正常连接到宿主机的mysql应该如何解决?...
- mysql查询出的数据转换为数字,关于sql:在MySQL查询中将文本转换为数字
- vue:前端压缩图片上传
- 【happyz】数字信号处理MATLAB学习-代码整理01
- python 腾讯视频签到_腾讯视频签到函数/网页2次签到
- {魔兽编辑器学习笔记} 一 安装编辑器、创建地图
- 北大青鸟深圳嘉华分享MySQL基础知识
- [Web/IP]真实IP获取原理/客户端IP伪造测试