当您实现SpinnerAdapter时,您将获得getDropDownView,它与getView您需要扩展时的不同之处BaseAdapter.
我正在尝试将android actionbar微调器自定义为类似google current应用程序的东西.基本上,只有'副标题'应该反映我从旋转器中选择的内容,而'标题'保持不变.我知道需要创建自定义微调器,我必须覆盖 getView()和getDropDownView()方法.但我在这里非常困惑如何正确地覆盖这些方法.有些人可以在正确的方向上推动我.我希望我明白我的问题.
图片截图http://androidcowboy.com/wp-content/uploads/2012/12/google-currents-3a.jpg
以下是我的代码.
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 …Run Code Online (Sandbox Code Playgroud) customization android spinner android-actionbar drop-down-menu