android会阻止屏幕上的部分地图拖动 [英] android prevent part of the map on screen from dragging
本文介绍了android会阻止屏幕上的部分地图拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在框架布局内部有地图片段,并且我想要禁止它拖动时,我将在其上使用另一个包含器(例如相对布局),其中将包含seekbar和一些textViews。
I have map fragment inside of the frame layout, and i want to disable it from dragging when i will be using another containter(e.g relative layout) on top of it, which will contains seekbar and some textViews.
我不想在映射时拖动我的容器中的某个区域,而不是它内部的项目。有没有办法做到这一点?如何禁用屏幕上的那部分地图?
I don't want to map drag when i accidently touch some area in my container and not the item inside of it. Is there a way to do this? How to disable that part of map on screen?
我的布局示例:
My layout example:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/maps_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.app.activity.MapsActivity"></fragment>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom">
<com.example.app.ui.views.CustomRelativeLayoutContainer
android:id="@+id/mainMapSlider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_gravity="bottom"
android:layout_marginBottom="20dp"></com.example.app.ui.views.CustomRelativeLayoutContainer>
<ImageView
android:id="@+id/addSeekBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="22dp"
map:srcCompat="@mipmap/ic_history" />
</RelativeLayout>
</FrameLayout>
推荐答案
只要让
Just make your RelativeLayout
clickable adding this:
android:clickable="true"
这篇关于android会阻止屏幕上的部分地图拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文