Note that there are some explanatory texts on larger screens.

plurals
  1. POActionbar spinner customisation
    primarykey
    data
    text
    <p>I am trying to customise the android actionbar spinner to something that like the google currents application. Basically, only the 'subtitle' should reflect what i choose from the spinner while the 'title' remains the same. I understand that a custom spinner needs to be created and I have to override the <code>getView()</code> and <code>getDropDownView()</code> method. But I am very confused here on how to override these methods properly. Can some please nudge me in the right direction. I hope I made my question clear.</p> <p><a href="http://androidcowboy.com/wp-content/uploads/2012/12/google-currents-3a.jpg">the image screenshot http://androidcowboy.com/wp-content/uploads/2012/12/google-currents-3a.jpg</a></p> <p>Given below is my code.</p> <pre><code>public class CustomSpinnerAdapter extends BaseAdapter { private LayoutInflater inflater; private final Context context; private final String[] dropDown; private final String mainText; private final String subText; public CustomSpinnerAdapter(Context context, String mainText, String subText,String[] dropDown) { inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.mainText=mainText; this.subText=subText; this.context = context; this.dropDown=dropDown; } @Override public int getCount() { // TODO Auto-generated method stub return 0; } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View actionBarView = inflater.inflate(R.layout.custom_spinner, null); TextView textView = (TextView) actionBarView .findViewById(R.id.custom_spinner_textview); textView.setText(mainText); return actionBarView; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View dropDownView = inflater.inflate(R.layout.custom_spinner, null); TextView dropDownTextView = (TextView) dropDownView .findViewById(R.id.custom_spinner_dropdown_textview); dropDownTextView.setText(dropDown[position]); return dropDownView; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload