- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个 ListView,左侧有图像,中间有标题和副标题,右侧有一个 ImageButton(此按钮右侧没有任何边距)。
<ListView
android:id="@+id/contacts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="@android:color/transparent"
android:fastScrollEnabled="true"
android:scrollbarStyle="outsideInset"/>
我为此 ListView 启用了快速滚动。当我尝试单击右侧的 ImageButton 时,滚动条成为焦点并且 ListView 开始滚动。我无法选择右侧的按钮。请帮帮我。
最佳答案
您需要覆盖 ListView
类及其 onInterceptTouchEvent
方法。
public class CustomListView extends ListView {
public CustomListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
setFastScrollEnabled(false);
boolean possibleResult = super.onInterceptTouchEvent(ev);
setFastScrollEnabled(true);
boolean actualResult = super.onInterceptTouchEvent(ev);
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
return possibleResult && actualResult;
}
return super.onInterceptTouchEvent(ev);
}
}
但是,您观察到的问题是预期的行为。
正确的解决方法是在行尾添加填充。
看看 Google 的 PhoneBook 应用程序,例如:
正如您在此处看到的,单元格大小小于屏幕宽度的 100%。
希望对你有帮助
关于android - 无法在启用 FastScroll 的 ListView 上选择右键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35008505/
我有点困惑。在 : http://delphi.about.com/od/objectpascalide/l/blvkc.htm 它说“Space”的正确键是#20。试过了,但行不通。但是,将其替换为
我有一个 input 的 type="submit" 并且我希望当我点击(右键或左键点击)它时这个元素周围没有蓝色边框。 我在下面的chrome浏览器中添加了OK模式和not OK模式的图片: OK模
我想在右键单击选项卡标题时显示上下文菜单条。 但是,我没有找到检测选项卡标题点击的方法。 有人知道如何做到这一点吗? 最佳答案 Private Sub tab1_MouseClick(sender A
我对编程还很陌生,正在尝试制作扫雷 GUI。游戏完美地右键单击 JToggleButton,在按钮上显示了一个代表炸弹的“B”,但是当我在鼠标监听器中用 setIcon() 替换 setText()
我正在尝试将一个按钮 float 到卡片的右侧。我希望它出现在右下角。 当我正确使用 float 时。它出现在父 div 之外,有没有办法正确定位它?
我正在使用 Struts2 标签和下面的代码使用 JS 计算并检查/验证在文本字段中输入的值。 它还会更新在 textfield 中输入的总数列表,这些由 onblur 处理和 onkeydown事件
我是一名优秀的程序员,十分优秀!