我已實現了以下庫飛旋在我的應用程序,即從XML我怎麼能在MaterialBetterSpinner庫
<com.weiwangcn.betterspinner.library.material.MaterialBetterSpinner
android:id="@+id/insurer_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_insurer_code"
android:textColor="@color/smart_primary"
android:textColorHint="@color/input_register_hint"
app:met_floatingLabel="normal" />
和Java代碼
public class testActivity extends Activity implements OnItemSelectedListener
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
Toast.makeText(adapterView.getContext(), "Selected: " , Toast.LENGTH_LONG).show();
// On selecting a spinner item
String item = adapterView.getItemAtPosition(i).toString();
// Showing selected spinner item
Toast.makeText(adapterView.getContext(), "Selected: " + item, Toast.LENGTH_LONG).show();
}
但onItemSelected沒有火起來的時候實現onItemSelected從菜單中選擇一個項目。將不勝感激關於如何成功實現上述庫的任何指導。