【发布时间】:2014-11-08 11:51:09
【问题描述】:
我在 FrameLayout 中有一个 ScrollView 和一个 ImageView。 ImageView 在滚动视图的后面
我的 ScrollView 有一个透明空间(LinearLayout s_layout_transparent,高度为 925px)。
所以通过这个透明空间可以看到我的ImageView但是不能点击。
我试图添加一些值 (android:clickable="false" android:focusable=" android:focusableInTouchMode="false") 来滚动视图以防止它拦截点击事件ImageView 但这根本不起作用。
这是我的布局:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:gravity="top|center_horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="10dp"
>
<ImageView
android:visibility="visible"
android:id="@+id/s_imgv_splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/temp_detail_screen_splash"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</LinearLayout>
<com.dreambox.android.saven.Views.ScrollView
android:id="@+id/s_scrollview_event_detail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none"
android:visibility="visible"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusableInTouchMode="false"
android:focusable="false">
<LinearLayout
android:id="@+id/s_layout_transparent"
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="925px"
android:orientation="horizontal"
android:background="@color/trasparent"
android:clickable="false"
android:focusableInTouchMode="false"
android:focusable="false">
</LinearLayout>
<LinearLayout...>
<LinearLayout...>
</LinearLayout>
</com.dreambox.android.saven.Views.ScrollView>
</FrameLayout>
【问题讨论】:
-
制作自定义滚动视图
-
你能说得更具体点吗?如您所见,我的滚动视图已经是自定义的 ScrollView
-
等等,从头开始。只需将 Imageview 移动到滚动视图内的线性布局内即可。
-
我故意留下ImageView,因为我希望当scrollview向上滚动时,imageView慢慢被scrollview内容覆盖。注意:滚动视图不仅有透明的线性布局,而且在下面也有一些线性布局(你可以在我的布局中看到
) -
我有一个建议:在
ImageView之上的每个View使用`requestDisallowInterceptTouchEvent`。
标签: android android-layout touch-event