android - Scroll and click on item inside ScrollView
<p>I am having a trouble using Scrollview of linearlayout which contains some imageviews as i want to click on each imageview separately but the onclick method just gives me access to the linearlayout.</p>

<p>this is the layout for the scrollview which contains the linearlayout</p>

<pre><code>        &lt;HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/horizontalScrollView"
            android:layout_below="@+id/seekBar"
            android:layout_alignParentLeft="true"
            android:layout_above="@+id/nextButton"
            android:layout_alignParentRight="true" &gt;

            &lt;LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/eyesScrollView"&gt;&lt;/LinearLayout&gt;
        &lt;/HorizontalScrollView&gt;
</code></pre>

<p>and i add the imageviews programitically by this code</p>

<pre><code>LinearLayout eyesScrollView = (LinearLayout) findViewById(R.id.eyesScrollView);
        for (int k = 0; k &lt; 5; k++) {
            ImageView imageView2 = new ImageView(this);
            imageView2.setId(k);
            imageView2.setPadding(2, 2, 2, 2);
            imageView2.setImageBitmap(BitmapFactory.decodeResource(getResources(), eyesArrayList.get(k)));
            eyesScrollView.addView(imageView2);
        }
</code></pre>

<p>and this is the code which access the linearlayout onclick</p>

<pre><code>@Override
    public void onClick(View view) {
        LinearLayout manyPics = (LinearLayout) view;
        manyPics.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view){
                Log.v("theID",String.valueOf(view.getId()));
            }
        });
    }
</code></pre>

<p>please can anyone helps me with that problem</p>