I do not have any idea how to implement such search bar behaviour in Android, could you suggest something please?
Search bar should expand when user overscroll the page down and collapse when user scrolls up. Take a look at the video by link below:
https://www.youtube.com/watch?v=2gwBiNISoFs
i see the video you provide you can easily implement that behavior using motionLayout in android, i can't write the code for that here but here is the documentation:
MotionLayout:https://developer.android.com/training/constraint-layout/motionlayout
basically all u have to do is adding a swipe handler for your contact list and change the scale of searchView and title, android studio 4.2 provides easy interface to implement all that
Related
I'm looking to create a custom menu for text selection. I know it's possible to edit the behaviour of the action bar with setCustomSelectionActionModeCallback, but in my case I don't want that action bar to show at all, I want my own floating custom menu which I have already achieved.
Only thing is that there is no way to not show the action bar menu after selecting the text in the TextView.
The behaviour I need is not the standard cut/copy/paste, the actions I have implemented are for highlighting and saving the highlighted section of text to a database.
I have done some tinkering and the best I could do was a messy reflection idea whereby I returned false in onCreateActionMode and got references to the text selection handles through reflection. It half worked and it's just as well because any form of reflection in this case is very bad practice.
My hope was that the last support library would have included the floating text menu in 6.0, and I though I could implement my own custom view in that menu, but that's wishful thinking.
If anyone has any ideas or libraries that might be of use then I'm all ears.
As you already noticed, using reflection is one of the ways. I'm pretty sure that it's the only one. If you're interested in what I did with that menu, check out Carbon. Its EditText does pretty much what you need, but with reflection as well.
The code snippet is way too long to paste it here, but here are the links:
https://github.com/ZieIony/Carbon/blob/master/carbon/src/main/java/carbon/widget/EditText.java
https://plus.google.com/109054799904873578131/posts/BH6r9J5gnw6
Basically I'm hiding the fancy Samsung's menu, disable the standard Action Mode and show my own popup window with options connected to standard copy/paste click handlers.
I want to have a login view similar to foursquare, can any one tell me how can i achieve this ? i have this youtube video for reference. http://youtu.be/RmQH0s2f2D8
You can use ViewPager to achieve that.
Here are a few tutorials on it if the one above doesn't suffice.
Android User Interface Design: Horizontal View Paging
Android (support v4) ViewPager tutorial (including source code)
Working with Fragments and ViewPager on Android
You're looking for a ViewPager
The Docs are pretty good in this case, so that should help.
As far as the popup at the bottom of the screen, you can hook it in to a page change listener and animate it up/down depending on the page.
I wonder how can I make a ListView's elements slide out on slide, like the way you can slide a notification from the notifications bar in Android. This is my situation:
I have a list of items, and, when the user wants to remove an item from this list, she simply slides an element towards the edge of the screen. I would like this slide-out to be visible, e.g. to use some kind of animation that slides out that given View holding the item.
Here are some images to illustrate this.
First, this is the normal state of the notification.
And then, this is during slide-out
Thanks.
The Android class com.android.systemui.statusbar.policy.NotificationRowLayout (Android 4.1.1 versions throughout) appears to be the manager of the notification bar rows, and it uses a helper class com.android.systemui.SwipeHelper which appears to do precisely the sort of thing you want.
So NotificationRowLayout is an example of the use of SwipeHelper which is hopefully the thing you were looking for!
Roman Nurik (Android developer advocate) created a quick-and-dirty swipe-to-dismiss implementation. Jake Wharton backported it, using NineOldAndroids, to work on earlier Android versions. You might give one of those a try.
In my application, I want to have behavior like facebook app wherein on click of icon I'd like to shift the whole screen towards right and display some menus on the left as shown below:
Before Clicking Menu Button
After Clicking Menu Button
One way is to have a layout with those menu in black color and set its visibility to gone
But in that case, the shifting animation won't be there like it is there in facebook. So is there any way we can do this?
This UI Pattern is currently being referred to as Side Navigation and discussed in some detail here:
http://www.androiduipatterns.com/2012/06/emerging-ui-pattern-side-navigation.html
The article also links to several projects that have implemented this navigation:
https://github.com/korovyansk/android-fb-like-slideout-navigation
https://github.com/darvds/RibbonMenu
https://bitbucket.org/jfeinstein10/slidingmenu/overview
https://github.com/Gregadeaux/android-fly-in-app-navigation
It is worth reading the article for its discussion about the issues with this kind of navigation also, though.
I have not implemented it but give you an exact idea that you have to use fragment for this.
Go through this link
This is the best that I've found https://github.com/DWorkS/ActionBarToggle because it's implementation is similar to DrawerLayout from google using ActionBarToggle. Although, it has a problem with open method but I wrote to its owner and he said that he will solve.
I am looking to create a navigation or menu bar similar to the functionality of the one at the top of the Fox News app. I started to code this myself using a Gallery but I'm not sure how to hide the left and right arrows when they are not needed. I was also wandering if you would have to use images for the menu items or if you could just use TextView or buttons so I could change the text without having to modify an image. I have seen this type of navigation on several apps and I tried all types of searches trying to find code examples but I must not be using the correct name for this type of scrollable menu because I couldn't find anything. If anyone has an example or provide a link to an article I would greatly appreciate it.
Look into HorizontalScrollView. It is a Layout that will handle the smooth scrolling and is likely to be much less of a hassle to work with than Gallery for this operation (I just added one for a similar reason).
To handle the left/right, look into setOnTouchListener. I'm not sure if you can get the current scroll position without making a new child class of HorizontalScrollView to access protected methods. There may be other ways, however - I didn't need to add buttons so I didn't investigate.