Fragment layout seems to not be interactive/clickable - android

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

Related

Screen press (on mobile) not registering on intended element Unity 3d

I have a grid of buttons (using grid layout group). I created this by adding a UI element and duplicating it 9 times (10 buttons) and then just applying a grid layout group to the parent object while all of the buttons were still at 0,0,0. This laid out the buttons exactly as i wanted in the grid shape that i chose. When i run this on PC and click a button, it registers perfectly. When i build it down to an apk and put it on my android, the buttons don't click when you press on them, but rather when you press way off to the right in some empty field space. But the "clickable grid area" as i'll call it, is perfectly transposed into that open field space. So i have my 5x2 visible button elements on the screen. If i touch them, nothing happens. Randomly touch in empty space until one of the buttons activates, and the clickable grid is in the exact shape of the visible elements except not on top of the elements. I'm not 100% familiar with resolution settings yet but i don't think that has all too much to do with this. What am i missing and what settings can i change?
so the problem ended up being that the anchors were not set to center, they were set to top left. This was set automatically by the grid layout group component. Remove grid layout, set positions manually, all is well.
You need to define column and row for each button

Making simple UI change animations. Pop-ups sliding from the edge of the screen

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')

android animating views between pages

I have been researching for the same since two days. Here is what i want to achieve. I havent ever tried much animations in android so please clear my approach wherever required. I will have two pages/screens (one visible at a time) Now when I am on page1, on swiping right to left page 2 will be displayed (achieving this is not that difficult) But here is my problem : when I am scrolling to page2 i would like to animate/translate/slide an image from page1 to page2 (without touching the image) and let the image sit on page2. I am just not sure of how to start with this.
I have thought of few ideas
First: I think i should implement a layout larger then window and then do the required animations and scrolling in it using horizontal scrollview.But now here I am not sure how will I make it look like they are 2 different pages(concerned about handling different screen sizes)
Second:I have seen example libraries of draggable gridview viewpager. But here both of my pages will have different layouts
Third:I am thinking of dividing both of my pages. the lower part of my pages will contain framelayout where I will only change the framelayout's content on scroll and perform hide n show trick on the upper part.But here again the trick is how am I supposed to place the image(contained in framelayout) to upper layout with an animation(image sliding to the top side on its own kind of animation)
Any Ideas. Any views/suggestions. Need all of it.Thank You for your valuable time.
This happens when I am trying to move the image to screen's top-left position. It moves in the left top direction as shown in the images below..
This happens when I am trying to move it besides second fragment textview
But the problem is I want to move it besides second fragment textview while scrolling and when scrolling is done it should come to top left of the screen just like the second fragment textview

Navigation controls on a mapview

Im asking a question here without any code because I don't even know if its possible. I have a MapView on an Android application which fills the width of its parent layout but not the height because the map displays a few overlays of locations and then below is a list of the locations and the user can select the one they want or to add a new location to the database. So it goes like this:
Scroll View
LinerLayout
Map View
Text View (of the overlay names on map)
/LinearLayout
/Scroll View
The problem here is that when I try to navigate north and south on the map it just scrolls with the scroll view. I expected it to move the map and only the scroll view if I clicked outside the map. It moves left and right as expected.
So what I was wondering was is it possible to either have some sort of lock function on the map so when you click on it you can navigate around it fine and then click else where on the screen and then you will navigate up and down using the scroll view. Or is there someway to have the up down left and right arrows on the map like the standard google maps do?
(I can navigate around the map fine if I use the roller ball (using the G1 phone) but it is incredibly slow)
Hope this makes sense
Do not put a MapView in a ScrollView. It simply does not work, as you are discovering. Do not put anything that knows how to vertically scroll (MapView, ListView, WebView) in a ScrollView.
Or is there someway to have the up down left and right arrows on the map like the standard google maps do?
You are welcome to create something, but there is no built-in capability for this.

Sliding in a layout for user input

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

Categories

Resources