0

I have layout in the background with view pager and on top of that i have layout which has the text layout.Since background view has view pager and should be visible i have given some padding to the top view.

Here is the layout :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@+id/frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ViewPager
            .... />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                **android:paddingTop="150dp"** > <!-- padding to take some space on top>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/rounder_shape"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:orientation="vertical" >

                    <TextView
                        android:id="@+id/textView1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/hello_world" />

                    ... More text views
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    </FrameLayout>

</LinearLayout>

I need to get the view pager to accept touch from the top view or layout.

What i have tried so far :

1) Have tried with InterceptTouch but was not successfull.

2) Also have looked into link Here but it did not help me.

Hulk
  • 213
  • 2
  • 9
  • I'm not sure what is your exact intention but maybe TouchDelegate is what you need? – pskink Jun 16 '15 at 11:01
  • @pskink How that works ? let me know what is that you didint understand from my question i can explain you in a better way – Hulk Jun 16 '15 at 11:02
  • @pskink see this : http://stackoverflow.com/questions/10129092/android-overdraw-layout-allows-touch-through-linearlayout here he want to disable the touch but in my case i need to enable it – Hulk Jun 16 '15 at 11:03
  • TouchDelagate docs say: "Helper class to handle situations where you want a view to have a larger touch area than its actual view bounds." isn't it what you need? – pskink Jun 16 '15 at 11:05
  • @pskink Exactly the link is what i am looking for but its not working for me :http://stackoverflow.com/questions/19676712/pass-touches-to-the-view-under – Hulk Jun 16 '15 at 11:09
  • it is accepted and upvoted several times so it means it works, if it doesn't work at you it means it is not the remedy for your problem – pskink Jun 16 '15 at 11:13
  • What are you planning to develop? Can you please share the design mockup/blue print? So we can check for the feasibility on adjusting the layout if required. – Noundla Sandeep Jun 16 '15 at 11:24
  • @noundla requesyt you to please use my xml will give you broader idea, just replace the viewpager with some image view and remove the background border, you will come to know what i am talking about, sorry as i cant share the design :( – Hulk Jun 16 '15 at 11:27
  • try adding the marginTop to scrollview instead of android:paddingTop="150dp" for linearlayout. – Noundla Sandeep Jun 16 '15 at 11:30
  • @noundla i want the Text layout to scroll on top of the view pager so i have added padding to the linear lyout – Hulk Jun 16 '15 at 11:33
  • Try with this http://stackoverflow.com/a/17069353/1118772. Hopefully, customscrollview will resolve your issue. – Noundla Sandeep Jun 16 '15 at 11:41
  • @noundla I tried that still the scrollview is not allowing touch to the view behind. – Hulk Jun 16 '15 at 11:52
  • and what? did TouchDelegate work? – pskink Jun 16 '15 at 12:32

0 Answers0