Therefore, I want to be able to programatically control the spinners and do stuff when each option is selected (for example, to change the image file displayed next to the item too).
Basically put, I want to be able to register two spinnerarrayadapters for each item.
How would I do this?
This is my adapter:
ArrayList<String> spinnerArray = new ArrayList<>(Arrays.asList(getResources().getStringArray(R.array.spinnerIntervalTypeItems)));
final ArrayAdapter spinnerArrayAdapter = new ArrayAdapter<String>(
getContext(), R.layout.spinner_item, spinnerArray) {
//do not show the first element as enabled
@Override
public boolean isEnabled(int position) {
if (position == 0) {
return false;
} else {
return true;
}
}
//grey out the first element
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
TextView tv = (TextView) view;
if (position == 0) {
tv.setTextColor(Color.GRAY);
} else {
tv.setTextColor(Color.BLACK);
}
return view;
}
};
I am using the Board Fragment for this.
Essentially, each one of my items has the following xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@+id/item_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="2dp" android:paddingLeft="6dp" android:paddingRight="6dp" android:paddingTop="2dp">
As you can see, there are two spinners there.
Therefore, I want to be able to programatically control the spinners and do stuff when each option is selected (for example, to change the image file displayed next to the item too).
Basically put, I want to be able to register two spinnerarrayadapters for each item.
How would I do this?
This is my adapter:
Thanks