I'm not quite sure what to even call this. Rather than plain text editing I'd like to implement the same system here, so when a user types in other users' names followed by a space the name is replaced with a view like below. What are the basic steps to get this effect?
They are called chips.
Here are some libraries that might do the trick:
https://github.com/DoodleScheduling/android-material-chips
https://github.com/klinker41/android-chips
Related
I'm working on an application that should allow the user to tag a user onto an item. In Google Drive, for example, when you're entering users to send an item to, the user's name becomes it's own "view" in the textview so that it cannot be modified and broken.
My current implementation already contains an autocomplete registry of current users, and formats the usernames with html tags so that they're interpreted correctly by the backend, but it's still possible to tamper by moving the cursor to the center of the name and modifying it.
I would like at least an example of how to accomplish what I am trying to do. The problem itself is hard to search for, probably because I just don't know what to call it.
Example of what I'm looking for: http://imgur.com/EBDoWED
Eventually, I came accross this: https://plus.google.com/+RichHyndman/posts/TSxaARVsRjF
Seeing that they're called "chips" is making this a lot more researchable. I'm still a bit weary about what I'm going to do, but I've got enough resources to start.
I'm going to attempt to make a LinearLayout that dynamically contains "chips" and edittext views and handles most of the functions of an edit texts.
I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.
For example: i type abc and i get completed, with the rest of the text in grey: abc1#etc.etc and then click a button to keep this text or keep writing to filter this even further.
Do you think is is achievable somehow?
I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.
Why don't you try to implement a custom view?
Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.
Have a look at:
TextWatcher in order to see how detect the user input and progress
You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.
One thing that I don't like about this idea is the fact that if you have got:
Germans
Germany
...
You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.
use below example ... i think help you...
http://teamandroid4u.blogspot.in/2012/06/autocompletetextview-example.html
I have used this forum when I didn't know how to do something, but now I have decided to begin participating in it.
I would like to know how could I do a dropdown text (maybe it has a specific name and that's why I don't find any results on the internet). I mean, I have some tags in the screen (About, Company, Contact, ...). Each of these tags has a down arrow on the right side, and when I click it, it has to display (and hide if it's clicked again).
Here are the links with the images of what I want to do.
http://i45.tinypic.com/4fzoso.png
http://i47.tinypic.com/2u5886q.png
Thank you in advance!
You should use an ExpandableListView component.
There is a tutorial for it here.
Finally I did it with ImageViews and TextViews using the property android:visibility. Now that it's a static version is working properly. I hope that it continues working well when taking the information from the DB
I am looking to create something very similar to what Google has done in the Google+ app.
Its hard to describe but please take a look at this screenshot
Google+ app
I am looking to create something similar, of note is that the tags move to the proper line as they fit.
Is this a completely custom solution that Google wrote or is there a library for this somewhere.
It looks like they are decorating the text in the edit text by using spans. They probably have a listener on the edit text listening for modifications at which point they check to see if the most recently added word matches one of your circles. If it does, the create a span over the text and decorate it with a background drawable, font color change, and by adding an image next to it.
Its probably a pretty significant effort depending on how you want to function, but all that functionality is out there in the sdk.
I am new to android. I was stuck on a problem but I finally solved it.
I was using a TextField instead of CompleteTextViewField so whats the difference between these two and when should I use each one of them?
Thanks
Neither of those classes you mention (TextField, CompleteTextViewField) exist. Do you mean EditText and AutoCompleteTextView? I think the documentation explains it pretty well:
[AutoCompleteTextView is] An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
That is, use it rather than a normal EditText if you have a set of common autocompletions for what gets entered in the box. The docs also link to a full sample that shows how to populate that list of suggestions with an Adapter.