I have such a question, I am developing an Android Application for learning languages. In my application, you can read books and when you click on a word, a window should appear on top of the word. This window will translate the word into the desired language and the ability to save the word. The question is what should I use to implement this window?
(maybe it's a Dialog or a PopupWindow? But how to make it appear on top of this word?)
Here is a screenshot from another application to make it clear what I mean.
screenshot
I already know how to add a word click listener, get that word and translate it. The only question is how to implement this View
Use custom view with tooltip,
this is a great library you can use it : Android Simple Tooltip
example :
View yourView = LayoutInflater.from(context).inflate(R.layout.custom_dialog, null);
new SimpleTooltip.Builder(this)
.anchorView(yourView)
.text("Texto do Tooltip")
.gravity(Gravity.END)
.animated(true)
.transparentOverlay(false)
.build()
.show();
Related
I'm quite new to android studio so be easy please.
For now I'm doing my best to implement MVVM pattern using Kotlin.
I want an app which is shows Persons in a list (For now I'm using Recycle View with a Text View inside). I want user to be able to tap on a Person and after tap Person card would pop up. The questions are:
Which component should I use instead of Text View to observe user's tap?
Which components should I use for Person card? Person(Name, Last name, Age, Avatar(jpg img))
You can just use the text view. Just set an onClickListener to know when someone taps it.
Depends on the exact UI you want. A dialog might fit, with whatever you want inside it.
I am just starting with android. This is what i want to make:
Now when you click on From, a new screen would open where you can select places and once you select you will get back to this screen where instead of "Bangalore" it would be the place you selected.
What kind of a field is this ? Text field ?
Also if i want to add any effect like when you click on it its color changes, how would i go about it ? Any tutorials or documentation i can check out for this.
Yes, you will probably want to use TextView.
You can change the text it displays by using SetText(), and you can change the text color by using SetTextColor().
You need a TextView to display text, but if you want to display an image, text and be able to interact with that, then Button or ImageButton is what you need.
Your question is too broad, so I encourage you to start doing some tutorials. To implement all that stuff you'll need to learn about layouts and activities, dialogs, listviews, ... Basic Android, but it needs a minimum of experience.
I am implementing a text editor (not using TextView or EditText components) and when a word is misspelled I would like to bring up a popup similar to what TextViews have after you tap on the word. Is this UI the TextView brings up available in the android framework to use or will I have to create my own custom UI for this?
I can't seem to find anything after searching through the documentation. All I can find is a spell checker framework which just tells you if a word is misspelled and gives you an array of suggestions. Is there something in the input method service that might provide this UI?
Edit: I also need the "Add To Dictionary" option in the context menu so the user can add new words to the user dictionary. Similar to how TextView does it.
I haven't implemented it myself yet, but it looks like using a ListPopupWindow will work. It also interacts with IME if you wish and anchors itself to a parent view.
I am developing a chat application. And i want to have pop up window with smileys in it so that when user clicks on one of smileys it will be inserted to edit text box.
Does anyone know sample code for it?
I wanted code for both pop up window and code to embbed smileys in an application.
(same as in case of yahoo which has smileys.how to code for it and how to store them in database and all)
Take a look at the PopupWindow. You'll want to use it in similar fashion to this tutorial here: http://www.mobilemancer.com/2011/01/08/popup-window-in-android/.
I would populate it with your drawable images, and then attach to each image you create a onClickListener that would insert the smiley into whatever text window your using.
I'm not an Android expert, and I'm still learning myself, but this is one approach I would investigate.
Pretty new to android so excuse me if this is a really obvious question.
Say my application has a bunch of TextViews, each one showing the attributes of a certain product (name, price, etc). I have a button next to each of these TextViews labeled "modify".
How do I make it so that when I press the modify button next to a certain attribute, a popup window with a space to enter text into comes up so that the user can enter text into this box and then have the actual attribute listing on the original page change? Actually I just need a push in the right direction with creating this popup text field... not sure if there is already some built in functionality for this or if not, what would be the best way to create this kind of thing.
Thanks.
Why not have the modify button set TextEdit.setEnabled(true); and then change focus with TextEdit.setFocus? Note that both of these are inherited from view
If you really want a dialog you might want to looking into the AlertDialog.Builder. I know you can use it with buttons and radio buttons, but I'm not sure you can get it to work with a TextView.
Use a code like this for the input popup: Android dialog input text
In the positive button handler, set your edittext content programmatically like this:
myEditText.setText(value).
As simple as that. The only difference with a standard GUI framework is that you don't retrieve the value as a result of the popup function. Instead, you must provide an action handler.