2013-10-03 58 views
0

我有手勢疊加的問題。GestureOverlayView隱藏其子/隱藏在父項後面

我設計了一個帶分割視圖的畫廊。而且,我想要手勢識別。 之前我沒有分割視圖,所以那時我使用手勢疊加作爲父母,它工作正常。 但現在在拆分佈局它沒有得到重點。請檢查我是否做錯了什麼。 在此先感謝。

<?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="#FF0000" 
android:orientation="horizontal" 
android:padding="5dp" 
android:weightSum="2" > 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:background="#0000FF" 
    android:orientation="vertical" > 

    <GridView 
     android:id="@+id/PhoneImageGrid" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:gravity="center" 
     android:horizontalSpacing="5dp" 
     android:numColumns="1" 
     android:stretchMode="columnWidth" 
     android:verticalSpacing="5dp" /> 

    <ProgressBar 
     android:id="@+id/progress" 
     style="?android:attr/progressBarStyleLargeInverse" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:layout_gravity="center" 
     android:indeterminateOnly="true" 
     android:visibility="gone" /> 

    <VideoView 
     android:id="@+id/mVideoView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:keepScreenOn="true" 
     android:visibility="gone" /> 

    <android.gesture.GestureOverlayView 
     android:id="@+id/gestures" 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:eventsInterceptionEnabled="true" 
     android:gestureColor="#d80546" 
     android:gestureStrokeType="multiple" 
     android:orientation="vertical" /> 
</LinearLayout> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:background="#00FF00" 
    android:orientation="vertical" > 
</LinearLayout> 

回答

0
// try this 
<?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="#FF0000" 
       android:orientation="horizontal" 
       android:padding="5dp" 
       android:weightSum="2" > 

    <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:background="#0000FF" 
      android:gravity="center" 
      android:orientation="vertical" > 

     <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

      <GridView 
        android:id="@+id/PhoneImageGrid" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:horizontalSpacing="5dp" 
        android:numColumns="1" 
        android:stretchMode="columnWidth" 
        android:verticalSpacing="5dp" 
        android:layout_centerInParent="true" 
        android:visibility="visible"/> 

      <ProgressBar 
        android:id="@+id/progress" 
        style="?android:attr/progressBarStyleLargeInverse" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:indeterminateOnly="true" 
        android:layout_centerInParent="true" 
        android:visibility="gone" /> 

      <VideoView 
        android:id="@+id/mVideoView" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:keepScreenOn="true" 
        android:layout_centerInParent="true" 
        android:visibility="gone" /> 

      <android.gesture.GestureOverlayView 
        android:id="@+id/gestures" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:eventsInterceptionEnabled="true" 
        android:gestureColor="#FF0000" 
        android:layout_centerInParent="true" 
        android:gestureStrokeType="multiple" 
        android:orientation="vertical" 
        android:visibility="visible"/> 
     </RelativeLayout> 

    </LinearLayout> 

    <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:background="#00FF00" 
      android:orientation="vertical" > 
    </LinearLayout> 

</LinearLayout> 
+0

它的工作原理,但在這種情況下,滾動停止工作。 – Mack

+0

它工作正常,如果GestureOverlayView超出RelativeLayout – Mack

+0

@麥克,嗨,你可以PLZ upvote ans如果它對你有用謝謝... –