androidviewdialogpopupwindowcustom-view

Which View should I use for this? Android Studio


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


Solution

  • 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();