2011-10-04 92 views
0

我必須使用2個重疊的ScrollViews進行佈局。一篇是帶有「看評論」按鈕的文章。另一個視圖是透明的幷包含註釋,並且在單擊「查看註釋」按鈕時顯示在文章頂部。問題是,當顯示註釋並且沒有填充屏幕時,將屏幕觸摸到屏幕外(例如,下面的圖像上的「Retour」按鈕下方。這是一個iphone屏幕截圖,android上的設計是不同的)滾動文章。問題與重疊ScrollViews

enter image description here

此外,「案中LES住客評論」按鈕可以點擊,即使在它上面的另一個佈局。

爲什麼下面的視圖沒有禁用(按鈕,滾動...),當它有另一個頂部?如何做呢?

有人可以幫忙嗎?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:background="#FFFFFF"> 

    <RelativeLayout android:id="@+id/header" 
     android:layout_width="fill_parent" android:layout_height="49dp" 
     android:background="#e7e7e8"> 

     <!-- header --> 

    </RelativeLayout> 
    <ScrollView android:id="@+id/article_scroll" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:layout_below="@id/header"> 
     <LinearLayout android:layout_width="fill_parent" 
      android:layout_height="fill_parent" android:orientation="vertical"> 

      <!-- article --> 

     </LinearLayout> 
    </ScrollView> 

    <LinearLayout android:layout_width="fill_parent" 
     android:layout_below="@id/header" android:layout_height="fill_parent" 
     android:orientation="vertical" android:background="#50000000" android:visibility="gone"> 
     <ScrollView android:id="@+id/comment_scroll" 
      android:layout_width="fill_parent" android:layout_height="fill_parent"> 

      <!-- comments --> 

     </ScrollView> 
    </LinearLayout> 
</RelativeLayout> 
+0

好吧,對不起,我刪除了我的評論;-) –

回答

0

你絕對應該使用一個新的活動,您的評論和使用Transucent主題:

<activity android:theme="@android:style/Theme.Translucent"> 

http://developer.android.com/guide/topics/ui/themes.html

一些替代的主題應該滿足您的需求(對話框例如)

或模糊的背景:http://www.stealthcopter.com/blog/2010/01/android-blurring-and-dimming-background-windows-from-dialogs/

enter image description here

+0

謝謝。我用'@android:style/Theme.Translucent.NoTitleBar.Fullscreen' – jul

0

至於按鈕「Voir les Commentaires」,當第二層可見時,可以將其設置爲enabled = false。我不太確定atm,但我認爲你可以對底部的ScrollView做同樣的事情。