title: Buttons not clickable in ArrayAdapter
body: <p>I have a custom ListView + ArrayAdapter with expandable list items. When I expand a list item and scroll so that it is no longer visible, the buttons in the expanded layout are no longer clickable when I scroll back. The issue isn't consistent though; sometimes, when I scroll down and back up, the buttons are clickable. When I expand the list item and don't scroll, the buttons work just fine, so that is why I think it must be an error in ArrayAdapter.</p>
  
  <p>I have onClick set in XML, and when I have checked for clickable in getView of my ArrayAdapter, the buttons are clickable. </p>
  
  <p>Here is the getView of the ArrayAdapter; I am using multiple layouts in the adapter, and only the ParameterListItem is expandable/the item in question.</p>
  
  <pre><code> public View getView(int position, View convertView, ViewGroup parent) {
      final ExpandableListItem object = mData.get(position);
      final View view = storedViews.get(position);
  
      if (object instanceof FillerParamListItem) {
          return view;
      }
  
      //Load the holder
      ExpandingViewHolder holder = (ExpandingViewHolder) view.getTag();
  
      //Handle collapsing and expanding the cells
      if (((ParameterActivity) activity).listView.isExpanded() &amp;&amp; !object.isExpanded()) {
          view.setAlpha(.20f);
      } else {
          view.setAlpha(1f);
      }
  
      if (object instanceof SwitchParamListItem) {
          ...
      } else if (object instanceof DomainListItem) {
          ...
      } else if (object instanceof ParameterListItem) {
          if (((ParameterActivity) activity).listView.isExpanded() &amp;&amp; !object.isExpanded()) {
              holder.expandingLayout.setVisibility(View.GONE);
              holder.valueTextView.setVisibility(View.VISIBLE);
  
              if (activity.getCoreApplication().getOfflineMode()) {
                  holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.main_list_item_background_offline));
              } else {
                  holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.main_list_item_background));
              }
  
              holder.collapsedLayout.setElevation(0);
          } else {
              if (object.isExpanded()) {
                  holder.expandingLayout.setVisibility(View.VISIBLE);
                  holder.valueTextView.setVisibility(View.GONE);
                  holder.valueEditText.setVisibility(View.VISIBLE);
  
                  if (activity.getCoreApplication().getOfflineMode()) {
                      holder.expandingLayout.setBackground(activity.getResources().getDrawable(R.drawable.parameter_activity_expanded_layout_background_offline));
                      holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.parameter_activity_expanded_layout_background_offline));
                  } else {
                      holder.expandingLayout.setBackground(activity.getResources().getDrawable(R.drawable.parameter_activity_expanded_layout_background));
                      holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.parameter_activity_expanded_layout_background));
                  }
  
                  holder.collapsedLayout.setElevation(3.0f * activity.getResources().getDisplayMetrics().density);
              } else {
                  holder.expandingLayout.setVisibility(View.GONE);
                  holder.valueTextView.setVisibility(View.VISIBLE);
                  holder.valueEditText.setVisibility(View.INVISIBLE);
  
                  if (activity.getCoreApplication().getOfflineMode()) {
                      holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.main_list_item_background_offline));
                  } else {
                      holder.collapsedLayout.setBackground(activity.getResources().getDrawable(R.drawable.main_list_item_background));
                  }
  
                  holder.collapsedLayout.setElevation(0);
              }
          }
  
          if (object.getImgResource() != ExpandableListItem.NO_ICON) {
              holder.imageView.setImageBitmap(object.getImage());
          } else {
              holder.imageView.setVisibility(View.INVISIBLE);
          }
  
          holder.titleTextView.setText(object.name);
          holder.valueTextView.setText(object.getValue());
          holder.unitTextView.setText(object.unitSym);
  
          holder.descriptionTextView.setText(object.description);
          holder.useTextView.setText(object.hint);
  
          ParameterListItem parameterListItem = (ParameterListItem) object;
  
          //Register listeners for the seeker bar and EditText for this specific parameter
          TextListener editTextListener = new TextListener(parameterListItem, activity, view, holder.valueEditText);
          holder.seekbar.setOnSeekBarChangeListener(parameterListItem.getListener());
          holder.valueEditText.addTextChangedListener(editTextListener);
          parameterListItem.registerTextListener(editTextListener);
          holder.valueEditText.setOnEditorActionListener(editTextListener);
          parameterListItem.registerSeekBar(holder.seekbar);
  
          holder.valueEditText.setTag("PROGRAM");
          holder.valueEditText.setText(object.getValue());
          holder.valueEditText.setTag("NONE");
  
          //show value and symbols within the expanded cells for the seeker bar track
          holder.minValueTextView.setText(Util.getStringForFloat(parameterListItem.getMinValue()) + object.unitSym);
          holder.maxValueTextView.setText(Util.getStringForFloat(parameterListItem.getMaxValue()) + object.unitSym);
          holder.middleValueTextView.setText(Util.getStringForFloat((parameterListItem.getMaxValue() + parameterListItem.getMinValue()) / 2) + object.unitSym);
  
          view.setOnTouchListener(editTextListener);
      }
  
      object.assocView = view;
  
      return view;
  }
  </code></pre>
  
  <p>Here's my XML for the Expandable List Item (the first RelativeLayout is the collapsed view, while the second is the expanded view):</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/parentlinearlayoutid"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  
  android:clipToPadding="false"
  
  android:paddingBottom="3dp"
  
  android:layout_gravity="center_horizontal"&gt;
  
  &lt;RelativeLayout
      android:id="@+id/parameter_activity_parameter_background"
      android:layout_height="150dp"
      android:layout_width="530dp"
      android:orientation="horizontal"
  
      android:layout_marginBottom="10dp"
  
      android:background="@drawable/main_list_item_background"
  
      android:layout_gravity="center"&gt;
  
      &lt;ImageView
          android:id="@+id/parameter_activity_parameter_image"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
  
          android:layout_marginLeft="25dp"
          android:layout_marginTop="15dp"
          android:layout_marginBottom="15dp"
  
          android:adjustViewBounds="true"
          android:background="@null"
  
          android:src="@drawable/ic_launcher"
  
          android:layout_alignParentStart="true"
          android:layout_centerVertical="true"/&gt;
  
      &lt;TextView
          android:id="@+id/parameter_activity_parameter_title"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
  
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
  
          android:text="Title"
          android:textStyle="bold"
          android:textSize="21sp"
          android:textColor="@color/main_text_color"/&gt;
  
      &lt;EditText
          android:id="@+id/parameter_activity_parameter_edit_value"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
  
          android:layout_marginRight="10dp"
  
          android:layout_toLeftOf="@+id/parameter_activity_parameter_units"
          android:layout_centerVertical="true"
  
          android:inputType="number|numberSigned|numberDecimal"
  
          android:text="Name"
          android:textSize="18sp"
  
          android:selectAllOnFocus="true"
          android:visibility="gone"/&gt;
  
      &lt;TextView
          android:id="@+id/parameter_activity_parameter_value"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
  
          android:layout_marginRight="10dp"
  
          android:layout_toLeftOf="@+id/parameter_activity_parameter_units"
          android:layout_centerVertical="true"
  
          android:text="4"
          android:textSize="18sp" /&gt;
  
      &lt;TextView
          android:id="@+id/parameter_activity_parameter_units"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
  
          android:layout_marginRight="40dp"
  
          android:layout_alignParentEnd="true"
          android:layout_centerVertical="true"
  
          android:text="deg"
          android:textSize="18sp" /&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;com.idunnololz.expandingcells.ExpandingLayout
      android:id="@+id/parameter_activity_parameter_expanding_layout"
      android:layout_height="325dp"
      android:layout_width="530dp"
  
      android:layout_gravity="center"
  
      android:background="@drawable/parameter_activity_expanded_layout_background"
  
      android:elevation="3dp"
  
      android:layout_marginTop="-15dp"
  
      android:visibility="visible"&gt;
  
      &lt;View
          android:layout_width="475dp"
          android:layout_height="1dp"
  
          android:background="@color/secondary_button_color"
  
          android:layout_centerHorizontal="true" /&gt;
  
      &lt;RelativeLayout
          android:id="@+id/parameter_activity_parameter_slider_layout"
          android:layout_width="match_parent"
          android:layout_height="65dp"
  
          android:layout_marginTop="10dp"
  
          android:layout_centerHorizontal="true"
          android:layout_alignParentTop="true"&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_min_value"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
  
              android:layout_alignParentStart="true"
  
              android:layout_marginTop="10dp"
              android:layout_marginLeft="15dp"
  
              android:text="-20"
              android:textColor="@color/secondary_text_color"
              android:textStyle="bold"
              android:textSize= "18sp"/&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_middle_value"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
  
              android:layout_centerHorizontal="true"
  
              android:layout_marginTop="10dp"
  
              android:text="-5"
              android:textColor="@color/secondary_text_color"
              android:textStyle="bold"
              android:textSize= "18sp"/&gt;
  
          &lt;com.usb.exo.ui.CustomSeekBar
              android:id="@+id/parameter_activity_parameter_slider"
              android:layout_width="500dp"
              android:layout_height="wrap_content"
  
              android:layout_centerHorizontal="true"
  
              android:layout_marginTop="20dp"
  
              android:progress="1"
              android:progressDrawable="@android:color/transparent"
  
              android:thumb="@drawable/slidebutton"
  
              android:layout_alignParentBottom="true"
  
              android:isScrollContainer="false" /&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_max_value"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
  
              android:layout_alignParentEnd="true"
  
              android:layout_marginTop="10dp"
              android:layout_marginRight="15dp"
  
              android:text="10"
              android:textColor="@color/secondary_text_color"
              android:textStyle="bold"
              android:textSize= "18sp"/&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/parameter_activity_parameter_description_layout"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
  
          android:layout_below="@id/parameter_activity_parameter_slider_layout"
  
          android:layout_marginLeft="20dp"
  
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_description_title"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
  
              android:paddingTop="20dp"
              android:paddingEnd="7dp"
              android:paddingStart="0dp"
  
              android:text="Description"
              android:textColor="@color/secondary_text_color"
              android:textStyle="bold"
              android:textSize="18sp"/&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_description_text"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
  
              android:paddingTop="10dp"
  
              android:text="Increasing angle will bend user forward. Adjusts user comfort in sitting."
              android:textColor="@color/main_text_color"
              android:textSize="15sp"
              android:textStyle="normal"/&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/parameter_activity_parameter_use_layout"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
  
          android:layout_below="@id/parameter_activity_parameter_description_layout"
  
          android:layout_marginLeft="20dp"
  
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_use_title"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
  
              android:paddingTop="20dp"
              android:paddingEnd="7dp"
              android:paddingStart="0dp"
  
              android:text="Use"
              android:textColor="@color/secondary_text_color"
              android:textStyle="bold"
              android:textSize="18sp"/&gt;
  
          &lt;TextView
              android:id="@+id/parameter_activity_parameter_use_text"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
  
              android:paddingTop="10dp"
  
              android:text="Bends user forward or backward while sitting. Angle of torso relative to vertical."
              android:textColor="@color/main_text_color"
              android:textSize="15sp"
              android:textStyle="normal"/&gt;
      &lt;/LinearLayout&gt;
  
      &lt;RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
  
          android:layout_below="@id/parameter_activity_parameter_use_layout"
  
          android:layout_marginTop="20dp"
  
          android:orientation="horizontal"
  
          android:background="@android:color/transparent"&gt;
  
          &lt;Button
              android:id="@+id/parameter_activity_parameter_cancel_button"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
  
              android:layout_alignParentStart="true"
  
              android:layout_marginLeft="10dp"
  
              android:onClick="cancelClicked"
              android:clickable="true"
  
              android:background="?android:attr/selectableItemBackground"
  
              android:text="Cancel"
              android:textColor="@color/button_text_color"
              android:textSize="21sp"
              android:textStyle="bold"/&gt;
  
          &lt;Button
              android:id="@+id/parameter_activity_parameter_undo_button"
              android:layout_height="wrap_content"
              android:layout_width = "wrap_content"
  
              android:layout_centerHorizontal="true"
  
              android:clickable="true"
              android:onClick="undoClicked"
  
              android:background="?android:attr/selectableItemBackground"
  
              android:text="Undo Last Change"
              android:textColor="@color/button_text_color"
              android:textSize="21sp"
              android:textStyle="bold"/&gt;
  
          &lt;Button
              android:id="@+id/parameter_activity_parameter_apply_button"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
  
              android:layout_alignParentEnd="true"
  
              android:layout_marginRight="10dp"
  
              android:clickable="true"
              android:onClick="applyClicked"
  
              android:background="?android:attr/selectableItemBackground"
  
              android:text="Apply"
              android:textColor="@color/button_text_color"
              android:textSize="21sp"
              android:textStyle="bold" /&gt;
      &lt;/RelativeLayout&gt;
  
  &lt;/com.idunnololz.expandingcells.ExpandingLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>I expect "cancelClicked" to be called, but it is not. There does seem to be some action with the button (the background darkens). </p>