How to disable google maps touch events through a layout? (android) - android

Here is a screenshot of my application
If I touch the legend content, I can still move the map or click markers through the legend layout. Here is my XML
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.MapsActivity" />
<LinearLayout
android:id="#+id/legend_popover"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="10dp"
android:background="#color/white"
android:orientation="vertical"
android:radius="7dp"
android:visibility="gone">
...
I don't want to disable the whole map, I want to disable gestures only on the legend popover. Thank you #antonio for the answer

Use this
mMapFragment.getView().setClickable(false);

Another decent way to achieve the same.
googleMap.getUiSettings().setAllGesturesEnabled(false);

Add android:clickable="true" to your legend_popover layout

If you're using Kotlin:
mapView.getMapAsync {
it.uiSettings.setAllGesturesEnabled(false)
}

Related

How to remove space between app activity and navigation bar?

Screenshot was taken on Xiamoni Redmi Note5
In the emulator, this problem has not happened.
please help me.
Change your layout as follows:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".CatalogActivity" >
<ListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
// etc rest if the layout is the same

Can't Identify which element is used....?

I've an android application, which set Location based reminders. After I added an alarm, it displays as following.
I can't understand which component is used to display the small map and text both. Also the small map has location which I've selected on the map. I'm developing similar application, and I want to use this type of display feature.
That looks like a Lite mode Google Map to me.
this video is the best explanation on the internet and covers the use case i think you are refering to.
https://youtu.be/N0N1Xkc_1pU
You can check out my answer to another similar question here: https://stackoverflow.com/a/39462819/3456841
Here's the google developers page on the topic
https://developers.google.com/maps/documentation/android-api/lite
Also here's a link to a demo activity that uses lite maps in a list
https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java
you probably want your list item layout file to look something like
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="#+id/map">
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/created_at"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"/>
</RelativeLayout>
Note the map:liteMode="true" in the map fragment declaration.

How to overlap a layout with mapview

Hello everyone I'm developing an app. I want to overlap a layout with map like image show. I added framelayout but when i playing my hand over the framelayout it affect my map. How can i solve this issue ?
Thanks in advance.
PS: No matter context. My xml like this. But my touch on framelayout affect map too.
My Main.XML ;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity$PlaceholderFragment">
<com.esri.android.map.MapView
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.esri.android.map.MapView>
<FrameLayout
android:layout_width="240dp"
android:layout_height="400dp"
android:background="#fcccff"
>
</FrameLayout>
</RelativeLayout>
Inside your Frame layout set this attribute and let me know
<FrameLayout
android:layout_width="240dp"
android:layout_height="400dp"
android:background="#fcccff"
android:setClickable="true"
>
</FrameLayout>

Autocomplete list getting hidden due to another component below it

As mentioned in the title, my autocomplete textview suggestion list is getting hidden when I have a mapview just below it. I have commented the mapview in the below code and checked and it shows the autocomplete list. What need to be done in order that the the list is shown on top of the mapview below it?
layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/background_color"
android:orientation="vertical" >
<com.test.CustomAutoCompleteTextView
android:id="#+id/atv_places"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:background="#drawable/candidate_white_bg"
android:hint="#string/str_atv_places"
android:textColorHint="#color/grey"
android:singleLine="true" />
<com.google.android.gms.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
</com.google.android.gms.maps.MapView>
</LinearLayout>
Any help is much appreciated.
You could try using z-order(mAutocompleteTextView.bringToFront();, docs)
If doesn't work - try using same with RelativeLayout

Issue with sherlock actionbar

Image as seen in ICS
Where as when run in Gingerbread
XML code for the fragment
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/background"
android:id="#+id/homelayout" >
<ImageView
android:id="#+id/homepageLogo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/background"
android:alpha="255"
android:scaleType="fitXY" />
</LinearLayout>
Any reason for such strange behavior?
try changing
android:layout_width="match_parent"
android:layout_height="match_parent"
to
android:layout_width="wrap_content"
android:layout_height="wrap_content"
in your ImageView. I don't know how you use your XML, but by the looks of it you might also want to change te same parameters in the LinearLayout to "wrap_content". Now you are telling the ImageView to (probably) fill the whole area.
// Alex
The problem is observed only when you dynamically request for the actionbar from the code.
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
If you do it using styles, this problem is not seen.

Categories

Resources