0
我正在使用带有微调器(下拉式)的ActionBar,但事情是选择区域本身上的文本不应该是列表中的元素之一。此外,我使用自定义适配器来定制微调器中的元素,该自定义适配器还自定义选择区域。微调器下拉式自定义
可能是截图是最好的。这是我想达到什么:
这是我目前有:
从我的自定义适配器片段:
public class CategoriesDropDownAdapter extends BaseAdapter{
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.categories_drop_down_item, parent, false);
}
Category category = getCategory(position);
ImageView icon = (ImageView) convertView.findViewById(R.id.catIcon);
TextView title = (TextView) convertView.findViewById(R.id.catTitle);
//setting icon, title and background color
icon.setImageDrawable(category.getIcon());
title.setText(category.getTitle());
convertView.setBackgroundColor(category.getBackgroundColor());
//setting the width of the drop-down to take all the layout width
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(metrics);
convertView.setLayoutParams(new LayoutParams(metrics.widthPixels, 100));
return convertView;
}
}
如何避免自定义选择区域(酒吧本身的区域)使用自定义适配器时?我希望对该区域进行不同的定制(例如,在右下角没有那个三角形)。
如何,如果我的微调/动作条未在XML但在描述它做码? actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(new CategoriesDropDownAdapter(...),this); – Haji 2014-09-02 10:53:37