How do I create an Android Spinner as a popup?

You can use an alert dialog AlertDialog.Builder b = new Builder(this); b.setTitle(“Example”); String[] types = {“By Zip”, “By Category”}; b.setItems(types, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); switch(which){ case 0: onZipRequested(); break; case 1: onCategoryRequested(); break; } } }); b.show(); This will close the dialog when one of them is … Read more

Android: Where is the Spinner widget’s text color attribute hiding?

I think it’s probably this bit in styles.xml <style name=”Widget.TextView.SpinnerItem”> <item name=”android:textAppearance”>@style/TextAppearance.Widget.TextView.SpinnerItem</item> </style> <style name=”Widget.DropDownItem.Spinner”> <item name=”android:checkMark”>?android:attr/listChoiceIndicatorSingle</item> </style> -= EDIT =- Here’s the result: and here’s how it’s done: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”MooTheme” parent=”android:Theme”> <item name=”android:spinnerItemStyle”>@style/MooSpinnerItem</item> </style> <style name=”MooSpinnerItem” parent=”android:Widget.TextView.SpinnerItem”> <item name=”android:textAppearance”>@style/MooTextAppearanceSpinnerItem</item> </style> <style name=”MooTextAppearanceSpinnerItem” parent=”android:TextAppearance.Widget.TextView.SpinnerItem”> <item name=”android:textColor”>#F00</item> </style> </resources> Then just add … Read more

WPF loading spinner

A very simple “plug and play” spinner could be one of the spinning icons from the Font Awesome Wpf Package (Spinning icons). The usage is quite simple, just install the nuget package: PM> Install-Package FontAwesome.WPF Then add the reference to the namespace xmlns:fa=”http://schemas.fontawesome.io/icons/” and use the ImageAwesome control. Set the Spin=”True” property and select one … Read more

How to set font custom font to Spinner text programmatically?

This is what worked for me (using ideas both from CommonsWare’s and gsanllorente’s answers): private static class MySpinnerAdapter extends ArrayAdapter<String> { // Initialise custom font, for example: Typeface font = Typeface.createFromAsset(getContext().getAssets(), “fonts/Blambot.otf”); // (In reality I used a manager which caches the Typeface objects) // Typeface font = FontManager.getInstance().getFont(getContext(), BLAMBOT); private MySpinnerAdapter(Context context, int resource, … Read more

How to add items to a spinner in Android?

XML file: <Spinner android:id=”@+id/Spinner01″ android:layout_width=”wrap_content” android:layout_height=”wrap_content”/> Java file: public class SpinnerExample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String[] arraySpinner = new String[] { “1”, “2”, “3”, “4”, “5”, “6”, “7” }; Spinner s = (Spinner) findViewById(R.id.Spinner01); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arraySpinner); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s.setAdapter(adapter); } } See spinner example.

Android: Create spinner programmatically from array

ArrayAdapter<String> should work. i.e.: Spinner spinner = new Spinner(this); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String> (this, android.R.layout.simple_spinner_item, spinnerArray); //selected item will look like a spinner set from XML spinnerArrayAdapter.setDropDownViewResource(android.R.layout .simple_spinner_dropdown_item); spinner.setAdapter(spinnerArrayAdapter);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)