I'm displaying some controls such as text boxes above the game screen. When I hide the controls and then re-display them using setVisibility(), they move off the screen, however I can just see the bottom border of the bottom-most control, and selecting that brings all the controls back to the original position.
Can any of you tell me what is going on, should I be trying out some other layout?
Related
So here's the tricky or buggy thing.
I have an activity that displays a mapview (I don't believe this is important at all, but the mapview is from Carto Mobile SDK), and I have a few actions that trigger two fragments to be displayed over the current activity layout.
The first one, takes the whole screen and is fully interactive. There is a Toolbar, a few Spinners and some TextViews.
The second fragment that gets displayed, takes a portion of the screen (almost the lower half), and the elements I included are interactive (3 Image Buttons). However, if I click over a part of that layout that's on the lower half of the screen, that has a white background, is like it's 'invisible' to the touch event.
Let me rephrase it. There's a white box, that if I touch over it and I perform a movement, like if I was moving the map (the mapview behind it, which I can partially see), I can then see the map moving. Even though I'm seeing the white LinearLayout, with 3 Image Buttons in it, if I click somewhere where there isn't any of the Image Buttons, is like the LinearLayout isn't there and the map moves.
I attached a screenshot at the end. The area that I talk about is just on top of the Image Buttons (Route to, Route from and View details).
Can I stop that from happening? Is this due to Carto or is an Android thing?
You don't put any code above so I assume your root view doesn't have click event, only the 3 buttons have.
Add clickable="true" to your white panel's root view to capture all the touch event
The questions are quite FAQ-type, but I can't find any suitable tutorial and don't even know what exactly to search for
1) I've got a list filled with linearLayouts and need to set an animation for elements added to those layouts as shown on image. The animation is the element slides from under the existing layout elements. If an element is removed, the animation is the same reversed
2) There is a screen filled with elements. Tapping, for example, a certain button, you call a pop-up, which comes from the edge of the screen and is above the rest of the elements.
If you tap anywhere, except the pop-up,
a) it will slide back
b) you will interact with the objects which the pop-up does not cover
What makes such effects possible? How to implement them and what to read about?
For 1) Setting animateLayoutChanges=true for LinearLayout should do the job
For 2) You can open a Dialog on button click and customise the animations for the dialog by calling dialog.getWindow().setWindowAnimations('id of animation xml')
I have to create to sliders(relative layout with background image) which are partially displaying on the screen on the click of that slider it should move to right and fully displaying on the screen and on another click it should move towards left and partially displaying on the screen .
I have achieved this moving animation but my problem is that Relative layout appearing fully on the screen and I want it to be display only 80%.
I have gone through this and this tutorial.
Use SlidingPaneLayout
SlidingPaneLayout provides a horizontal, multi-pane layout for use at the top level of a UI. A left (or first) pane is treated as a content list or browser, subordinate to a primary detail view for displaying content.
Check this : SlidingPanelLayout
I have two Webviews but at certain point i would like to bring the one on the back to front. I want both visible.
Is it possible to change the layout order?
There is no concept of Z-axis position in Android view stack so you can't bring views to front or send to back. You need to set the view's visibility flag to hide, visible or invisible (.setVisibility(GONE , VISIBLE, or INVISIBLE) respectively). If you want them both visible at times then you need to have at least the top view (the one added to the parent view last) be with transparent background so that if their Visibilities are set to VISIBLE then the behind view will show through the top view.
Kevin
I have a ListView and each item contains a TextView displaying a number. I'd like to give my users the ability to change this number while staying on the ListView (as opposed to drilling down into a detailed view by clicking on the list item).
What I'm looking to do is to slide in a layout from the bottom of the screen that covers about half of the screen. I'd like this layout to be OVER the Activity behind it (as opposed to being part of that Activity's layout and simply showing it). I'd also like it to be model (or seem modal). Meaning the Activity behind it can not be focused and manipulated. In this layout I will essentially create a calculator.
What I need help with right now is:
1) How to display a layout over the current Activity
2) How make the background (the Activity) modal
Could someone point me to some tutorials/resources and/or give me a few tips?
use an Animation. here is a small tutorial on them: http://developerlife.com/tutorials/?p=343
initially, the view you want to be modal must be placed where you want it to show up(and visibility set to gone).
use a translate animation to visually move the view from below the screen to halfway up the screen. once the animation starts, set visibility to visible
try disabling all views that the user should not be able to interact with after you have started the animation holding the calculator view