问题标签 [clicklistener]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - android listview onItemClickListener 失败
我使用以下代码来监听我的列表视图 onItemClick 事件。没有发生编译错误,
当我点击任何列表项时没有任何反应,我不知道为什么 Orz
有人能告诉我为什么@@吗?
android - 一个 OnClickHandler 用于多个按钮
我发现自己一直在做这样的事情:
和
有没有更好的方法来设置 OnClickListener?
android - 从布局设置 ClickListener
从 Layout 设置 ClickListener 时遇到问题
在我的布局里面:
在主类(一项活动)中:
但似乎不处理点击事件。
android - Android:在循环中使用带有字符串 / 的 findViewById()
我正在制作一个 android 应用程序,其中有一个由数百个按钮组成的视图,每个按钮都有一个特定的回调。现在,我想使用循环设置这些回调,而不必编写数百行代码(针对每个按钮)。
我的问题是:如何使用 findViewById 而无需静态输入每个按钮 ID?这是我想做的事情:
提前致谢!
java - 你如何在 listView 上实现动作监听器?
几天来,我一直在努力寻找正确的方法来实现 ListView 的动作侦听器。我真正想要完成的是创建一个 ListView 并且每当用户单击任何项目时,都会切换以前的 Activity。我对此很陌生,所以请帮助我,我将非常感激。如果你能告诉我我在代码上做错了什么,那就太棒了!
我正在使用 [这里][1] 中的 Fedor 代码。
android - Efficientadapter OnItemClick 监听器
我listView
使用Efficient adapter
. 在我这样做之后onItemclicklistener
,列表视图不起作用。
每当我点击listView
,什么都不会发生。我不知道如何listener
给予efficient adapter
。我用谷歌搜索了这个问题,但我没有得到任何正确的答案,如果有人对这个特定问题有想法,请指导我。
android - OnClickListener NullPoinerException 错误?
我试图清理我的侦听器并且出错了:我在 LogCat 中使用以下方法得到了一个典型的“NullPoinerException”(第一次尝试这样做)。
有什么帮助吗?谢谢!
活动:
日志猫:
android - 如何在 BindView 中添加 Click 事件?
如何为具有绑定视图的适配器添加单击处理程序?刚开始。谢谢你。
android - How to make a group of clickable graphical object?
my question is how can I make a set of clickable images on Android.
I can make one clickable sphere by using ShapeDrawable, however I want to make more than one at once and still be able to get clicks in all of them.
Moreover I want to position them on screen at my will, instead of auto positioned as with layouts.
The number of spheres can change as can the places.
This is the code I use to make one:
Main.java
CustomDrawableView.java
Hope you can help :)
android - Android and making `this` a listener for one of its buttons
I have a custom view MyView
inflated from my_view.xml
(with a corresponding Java class MyView.java
).
I override MyView(Context context, AttributeSet attrs)
to connect subviews up to members of the class.
Now one of these subviews is a Button
, and I'd like for my view to listen for a click on its button before passing this event on to a delegate. However if I declare
this.myButton.setOnClickListener(this);
in the constructor MyView(Context context, AttributeSet attrs)
(where this
is an instance of MyView
) I get a NullPointerException
.
Where is an appropriate place in MyClass.java
to call this.myButton.setOnClickListener(this);
?
%%
Edit. Some code: