2017-04-10 72 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

相關問題