簡體   English   中英

ScrollViews重疊的問題

[英]Issue with overlapping ScrollViews

我必須使用2個重疊的ScrollView進行布局。 一個是帶有“查看評論”按鈕的文章。 另一個視圖是透明的,並且包含注釋,並且當單擊“查看注釋”按鈕時,該視圖顯示在文章的頂部。 問題是,當顯示注釋並沒有填滿屏幕時,將屏幕從屏幕上觸摸出來(例如,下圖所示的“ Retour”按鈕下方。這是iPhone屏幕快照,Android上的設計有所不同) )滾動文章。

在此處輸入圖片說明

另外,即使上面有其他布局,也可以單擊“ Voir les Commentaires”按鈕。

為什么下面的視圖沒有被禁用(按鈕,滾動...)? 如何做呢?

有人可以幫忙嗎?

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

您絕對應該使用新的活動作為評論並使用半透明主題:

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

在此處輸入圖片說明

至於“ Voir les Commentaires”按鈕,可以在第二層可見時將其設置為enabled = false。 而且我不太確定atm,但是我認為您可以對底部的ScrollView進行相同的操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM