long-press

android: How to increase long press time for listview items in android?

不羁的心 提交于 2021-01-27 06:44:46
问题 I have a custom listview , in which items are scroll horizontal . I want to perform single touch and longpress for items for 5 sec for listview items. How to do this. How can i increase longpress time interval for listview items to 5 sec. 回答1: This replicates onLongPress more accurately because it does not wait for the user to lift their finger before executing. Was written specifically for ViewPager, but should be able to apply similar logic. // long press duration in milliseconds public

android: How to increase long press time for listview items in android?

谁都会走 提交于 2021-01-27 06:42:25
问题 I have a custom listview , in which items are scroll horizontal . I want to perform single touch and longpress for items for 5 sec for listview items. How to do this. How can i increase longpress time interval for listview items to 5 sec. 回答1: This replicates onLongPress more accurately because it does not wait for the user to lift their finger before executing. Was written specifically for ViewPager, but should be able to apply similar logic. // long press duration in milliseconds public

Using long press gesture to reorder cells in tableview?

一曲冷凌霜 提交于 2020-01-22 10:44:05
问题 I want to be able to reorder tableview cells using a longPress gesture (not with the standard reorder controls). After the longPress is recognized I want the tableView to essentially enter 'edit mode' and then reorder as if I was using the reorder controls supplied by Apple. Is there a way to do this without needing to rely on 3rd party solutions? Thanks in advance. EDIT: I ended up using the solution that was in the accepted answer and relied on a 3rd party solution. 回答1: So essentially you

Possbile to long press button and change its text in Android

别来无恙 提交于 2020-01-06 02:54:09
问题 I am able to long press a button and change its text using clipboard on 5.0 and above. On long pressing cursor appears and clipboard can be opened. Any solution other that disabling the button ? I have tried setting onLongClickListener as null.Here is my button : <Button android:id="@+id/btn1" style="@style/ButtonRegular" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_margin="@dimen/md_8dp_margin" android

iPhone iOS how to add a UILongPressGestureRecognizer and UITapGestureRecognizer to the same control and prevent conflict?

天涯浪子 提交于 2019-12-31 09:21:52
问题 I'm building an iPhone app that would let the user rearrange some of the UI elements on the screen. How can I add a tap gesture recognizer and a long press gesture recognizer to the same UIView? When I lift up the finger from the long press, the tap gesture recognizer fires. How can I temporarily disable the tap gesture recognizer or prevent it from firing when the user is performing a long press? Thank you! 回答1: To allow both gestures to work together, implement the following delegate method

Override menu key long press and launch an application on long press

时光怂恿深爱的人放手 提交于 2019-12-25 04:59:13
问题 I want to do something like this- 1.Override the default action of the menu key long press (i.e. launching soft keyboard). 2.Whenever user long presses the menu key, my application will be launched. 3.Moreover, my application may not need to be in the foreground, i.e. even if someone long presses menu key from any other application my application should be launched. Is this at all possible? How? 回答1: Is this at all possible? How? By making your own firmware, where you add this capability to

Long press gesture recognizer on UIButton?

倾然丶 夕夏残阳落幕 提交于 2019-12-25 02:41:07
问题 I'm working on the Minesweeper game, I want to add the flag when user long tap on a tile of the gameboard. I've implemented this code: For every button in gameboard: UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressTap:)]; longPress.minimumPressDuration = 1.0f; [self.button addGestureRecognizer:longPress]; In self, the method longPressTap: - (void)longPressTap:(Tile *)sender { if (sender.block.marking == MARKING

Intents for EditText LongPress

随声附和 提交于 2019-12-25 00:35:55
问题 i want my application to be seen when a user long presses on edit text to copy or paste. or clicks on copy or paste. i tried with different intents like ACTION_PASTE , ACTION_EDIT But none are working for me !! Please help me out Thanks in advance. 回答1: There is no way for you to automatically appear in the action mode or context menu that appears when the user selects text in an EditText for other applications. For your own EditText widgets, you can use setCustomSelectionActionModeCallback()

Xamarin.Forms Long Press Effect - How to set the Command in Code Behind (NO XAML)

徘徊边缘 提交于 2019-12-23 02:57:12
问题 I'm using this solution for handling the long tap event: https://alexdunn.org/2017/12/27/xamarin-tip-xamarin-forms-long-press-effect/ It works fine when I use XAML, but I need to use code behind only. How can I add this command to the Image in the code behind? Here is the code that creates my image: var image = new Image { ClassId = item.Path, Aspect = Aspect.AspectFill, Source = item.ThumbNailImage, Rotation = 90, Margin = 10, GestureRecognizers = { _tgr }, //Command here, but how? }; 回答1:

SwiftUI: how to handle BOTH tap & long press of button?

感情迁移 提交于 2019-12-22 10:49:04
问题 I have a button in SwiftUI and I would like to be able to have a different action for "tap button" (normal click/tap) and "long press". Is that possible in SwiftUI? Here is the simple code for the button I have now (handles only the "normal" tap/touch case). Button(action: {self.BLEinfo.startScan() }) { Text("Scan") } .disabled(self.BLEinfo.isScanning) I already tried to add a "longPress gesture" but it still only "executes" the "normal/short" click. This was the code I tried: Button(action: