I'm building a flashcards app as a college project, and wanted a horizontally scrolling display of the cards. I've built an xml file for the flashcard design itself:

```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@drawable/whitenote" android:padding="3dp">

    <ImageButton
        android:id="@+id/imageButtonPins"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" android:background="@color/transparent" android:src="@drawable/pinselector"/>

    <TextView
        android:id="@+id/textViewWord"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageButton1"
        android:layout_centerHorizontal="true"
        android:text="Word" android:textColor="@color/black" android:paddingTop="30dp" android:textSize="20dp"/>

    <TextView
        android:id="@+id/textViewMeaning"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textViewWord"
        android:layout_centerHorizontal="true"
        android:text="Meaning" android:textColor="@color/black"/>

</RelativeLayout>

```

I've also created the Class file.

In the activity layout, I have a few more elements and as such a linearlayout at the root level is necessary. I've been able to display a single flashcard for test purposes using and using layout inflater.

**Question**  

In both the ways, in and layout inflater I've been unable to get the ImageButton working. My question is how do I get the button to work.

**Update: Managed to get the ImageButton working using . Realised that I have to handle the onclick event in the activity, and not the Custom Adapter class. This should allow me to obtain the words too, as long as I can keep track of the "current" flashcard on display**

Also, whats the best way to handle the scrolling for a flashcard app? My current plans so far is to use a HorizontalScrollView and customise it a bit, because I need (a) a swipe should make the flashcard move only to the next one (b) I need to focus on the "current" flashcard since I need some data from its children views (ie, the word).