Hello! There is a list of applications, on mobile devices there is a button to appear when you long press any of the list items. Before that, I didn’t come across such kind of elements, I ask you to suggest how such things are realized.
3 answers
$(document).ready(function(){ var shows = 0; $('#longClick').mousedown(function(){ shows = setTimeout(function(){ $('#shower').show(); }, 2000); }); $('#longClick').mouseup(function(){ clearTimeout(shows); }); $('*').not($('#shower')).mousedown(function(){ $('#shower').hide(); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div id='longClick'>Click me 2 second</div> <ul id='shower' style='display:none'> <li>text</li> <li>text</li> <li>text</li> </ul> <div class='other'>Click for close</div> <div class='other'>Click for close</div> - Mojito, thank you for the answer. If it doesn’t make it difficult for you, please supplement the script - it’s necessary that when clicking on third-party areas this window disappears .. - Igor
- onetry this ... - Mojito
|
To do this, in item_layout which is a single-line design, put a design inside RelativeLayout and then a button and a transparent background, put it on top of all other elements. and install
visibility="GONE" and when pressed, change it to VISIBLE
|
public static final int IDM_OPEN = 101; public static final int IDM_SAVE = 102; final TextView textview = (TextView)findViewById(R.id.textView); registerForContextMenu(textview); @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(Menu.NONE, IDM_OPEN, Menu.NONE, "Открыть"); menu.add(Menu.NONE, IDM_SAVE, Menu.NONE, "Сохранить"); } This button can also be called this way. This is called the context menu.
|

layoutfor a single element. (your code) so it will be easier for you to explain it. - SaidolimwebViewmobile version of the site can be different - throughwebView(a simple browser with the download of all html and zhs code) or native, referring directly to the database. - Silento