-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom view height is cut on Android 24 #40
Comments
I debugged this: mPopupWindow.showAtLocation(mRootView, Gravity.NO_GRAVITY, mRootView.getWidth(), mRootView.getHeight()); The mRootView of my button is the Toplevel Window. It is called with height = 1920, width = 1200 Which isn't the center position of the button? |
I personally think we need something like this:
|
The initial position set to Can you send a picture or screenshot of this problem? |
Thx for pointing me to the calculation function. I'll try hunting the bug ;) It's somehow strange only on the Nvidia Shield K1 (7" / 2015 / 7.0) there is this problem. I'll send you a merge request or a sample project if I can't find the issue. Thx! |
@egandro I think I found the problem, but not the solution yet. On Android 24, apparently, See on Android 23 (position adjusted): But, on Android 24 the size is adjusted automatically: I will work to find a solution, but suggestions are welcome 😄 |
Hey! I got a hint from a friend. It might be this flag: https://developer.android.com/reference/android/widget/PopupWindow.html#attr_android:overlapAnchor Can you give it a try? Thx. |
In my tests Setting But if the PopupWindow stays outside the screen, it can be hidden. Researching a little, I saw that the behavior of PopupWindow was changed on Android 24 and 25, but I'm not sure that this will change in the future.
I've created a test branch (632b028), if you'd like to check it out. dependencies {
// ...
compile ('com.github.douglasjunior:android-simple-tooltip:issue-40-SNAPSHOT') {
changing = true // Gradle will then check for updates every 24 hours
}
} |
Thx man! I'll give it a try. In a view minutes. |
Yes, the only solution I think is calculating the position manually. |
I have an idea ;) You can take the calculation algorithm from <24 and put it in your code. Check the license if this is ok. But that would fix it 100% |
It's not that simple, I'll keep thinking about a solution. One suggestion, your Tooltip has a lot of information, it was not designed to be so big. Would not it be better to display this layout in a Dialog? Or a tooltip centered on the screen? |
I experimented with this a lot:
My designer came up with the Popup solution as wie have it in the android simple tooltip. The user experience is very very cool - it's consumes less space - and despite having the same amount of clicks - the users love the tooltip style as it is fast and integrates fluently in the workflow. The dialog or the (default) context menu is a lot of slower and the user has to move the finger for a 20% longer distance ;) You might have a look at the bottom of this page. This is (ugly) Javascript - but it's the algorithm to place a content menu depending on a pivot point: https://stackoverflow.com/questions/15795253/positioning-context-menu Check this on jsfiddle: |
You can apply code on SimpleToolTip.java At Line 38x : Before call update PopupWindow
Apply this
|
Thanks @ThanawatMas , I'll look soon. |
Hey,
I have an issue on a Nvidia Shield K1 (Android 7.0). The height of a custom view is cut, when the anchor point is on the very top or very bottom of the screen.
On my phones / 10" tablet I don't have this problem.
The text was updated successfully, but these errors were encountered: