I have a window with one spinner at the bottom and one image at the top that fills the remaining space.
When i tap on the spinner it does nothing, like it’s blocked. I assume it’s due to the image leaving no available space for the expanded spinner to show.
So, i tried to add a touchListener so i would be able to change the image’s visibility to GONE and make room for the list of items to appear.
However, said listener is never been invoked when the image is present. If i remove the image in the xml, it gets invoked.
I also added an OnItemSelectedListener, but things go the same way: if the image is present, neither onNothingSelected nor onItemSelected are called, if i remove the image, they get called accordingly.
My question is: how do i shrink the image when the spinner is tapped so the user can see the options available inside it?
sp.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.d("SPINNER TOUCHED!!!!", "dasdsada");
return false;
}
});
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="nnn.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/image1"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="v1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="select somethung" />
<Spinner
android:id="@+id/stuff_spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:layout_width="423dp"
android:layout_height="wrap_content"
android:text="Next"
android:onClick="DoNext"/>
</LinearLayout>
</LinearLayout>
Thank you