I have a ScrollView and an ImageView inside a FrameLayout. The ImageView is behind the scroll view
My ScrollView have a transparent space (LinearLayout s_layout_transparent with 925px height).
So my ImageView can be seen through this transparent space but can not be click.
I have tried to add some value (android:clickable="false" android:focusable=" android:focusableInTouchMode="false") to scroll view to prevent it intercepts the click envent of the ImageView but this not work at all.
Here is my layout:
<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>
fillViewport allows scrollView to extend it's height equals to the full height of device screen's height in the cases when the child of scroll view has less height.
Only one view can be included in a ScrollView .
ScrollView and HorizontalScrollView has same attributes, the only difference is scrollView scroll the child items in vertical direction while horizontal scroll view scroll the child items in horizontal direction.
ScrollView is used to put different or same child views or layouts and the all can be scrolled. ListView is used to put same child view or layout as multiple items. All these items are also scrollable. Simply ScrollView is for both homogeneous and heterogeneous collection.
if you can fill the transparent parts with an empty view (lets call it dummyView), you can do something like...
dummyView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
// pass on the touch event to the ImageView
s_imgv_splash.dispatchTouchEvent(event);
// returning true because we handled the event
return true;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With