Tooltip on the screen - android

I want to implement tooltips to be shown near some Views in my application. How is it possible to show some views over existing layout? How to position it where I need?

Use a PopupWindow, you can show it at any position with it's showAtLocation() method.

Related

Using BottomSheetBehavior to show fragments

I'm trying to use the BottomSheetBehavior from Material. The problem is that it is not well described and no enough examples of it are available.
One example on Meduim, but it only shows the basics and very simple implementation.
What I exactly need is something like the one from Material here. But instead of clicking on the menu item to show the BottomSheet, I want to show it when user selects an item from RecyclerView. Also the peek height should show only the first element in the BottomSheet layout until the user pulls it up.
How to get this approach? Are there any useful example?
Make the bottom sheet hidden when you start your activity or fragment by calling bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN).
And in your adapter's onClick, make the bottom sheet visible, by calling bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HALF_EXPANDED)

Tooltip in Items within RecyclerView (Overlap above items)

I need to create a RecyclerView with multiple ViewTypes. However, on some of the items, I need to display a Tooltip which should hover over the above row.
My requirement is:
In the above image, there are 4 items in the RecyclerView, and the tooltip in the lower row should overlap on top of the above row (or rows, as required). This tooltip would only be visible in some scenarios - when the lock icon is visible.
The problem is, if I add this tooltip as a TextView to the row_layout.xml, and control it's visibility programmatically, it increases the height of that row and does not overlap onto the above layout.
How can I get this view to "hover" over the above rows without displacing them?
If you require code, I can edit this question and post the code too (but I think it might not be necessary here).
You can make use of Android Tooltips library.
Simple to use customizable Android Tooltips library based on PopupWindow. This Tooltips does not require any custom layout. It works as PopupWindow.
dependencies {
compile 'com.github.vihtarb:tooltip:0.1.9'
}
usage:
Tooltip tooltip = new Tooltip.Builder(anchorView)
.setText("Hello tooltip")
.show();
Dont know if it will work for recycler view ,but for list view you can use quick action item, complete article is over here also look at these Libraries some of them may work for recyclerview
You could use this library Super Tooltips
It is simple to use and powerful.

Design swipe activity android

I need to make a layout similar to that Image.
I wish it were shown all the registered images and their attributes and a button to add the user would select an image and define the attributes of it. I do not want a complete example that ordered but at least one direction than I use to do the layout. By my research I should perhaps use a swipe view. Has anyone seen something similar?
Thank you
You can use ViewPager to display cards like in top part.
ViewPager with previous and next page boundaries
And use a ListView or RecyclerView to show the bottom part. https://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465

Display view like a spinner's list without relativeLayout

For some reasons, I have to create a kind of custom spinner. I meam, I want to display a Button/an ImageButton and onClick on it, I want to display a list. But this list must be floating like with a spinner.
The problem is I haven't and I can't add a RelativeLayout as a parent.
So how can I add a view floating on the top and looking like a spinner's list ?
I need you ! :D
You can use PopupWindow and use showAsDropDown method to show it at any location you want, in your case make use your Button/ImageButton as anchor view.
you can follow this

GridView in android

I have a gridview of images in android. When i click any item on it, i want to show a new set of items over it. This is the screen shot .
Can this be done using gridview? Also what should be the type of view which must come over the gridview? The background should become preferably faded.
I am not so sure if you can achieve the second view using a grid view. In the grid view AFAIK you don't have any option of specifying the location of the grid elements. It just arranges it from left to right and wraps around.
But here is how I would do it -
First view can be done using the grid
view, as you already know/done.
For the second view since you want the the first view to remain in the background, there are two ways to go about this -
First option
You can use a dialog, you can create your own custom dialog which has makes it translucent.
In this custom dialog you can add further elements like images.Custom dialog example. For details on how to make it translucent you can look the sample app in android sdk.
Second option -
Use a layoutInflater. Put all your views into it.
You can display one view on top of another using the visibility attribute of the view. Layout Inflater

Categories

Resources