2017-04-10 71 views
0

我在框架布局内部有地图片段,并且我想要禁止它拖动时我将在其上使用另一个包含器(例如相对布局),它将包含seekbar和一些textViews。android阻止屏幕上的部分地图拖动

我不想映射拖动当我不小心触摸我的容器中的某个区域,而不是它的内部项目。有没有办法做到这一点?如何禁用屏幕上的那部分地图?

我的布局,例如:

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

回答

1

只是让你RelativeLayout点击添加此:

android:clickable="true" 
+0

感谢,效果很好! – Konrad

相关问题