2011-10-04 91 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做同样的事情。