public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(ITEM_LAYOUT, parent, false); } TextView title = (TextView) convertView.findViewById(R.id.title); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) title.getLayoutParams(); params.width = RelativeLayout.LayoutParams.WRAP_CONTENT; title.setLayoutParams(params); RelativeLayout layout = (RelativeLayout) title.getParent(); layout.setHorizontalGravity(getLayoutGravity()); MenuView.ItemView itemView = (MenuView.ItemView) convertView; if (mForceShowIcon) { ((ListMenuItemView) convertView).setForceShowIcon(true); } itemView.initialize(getItem(position), 0); return convertView; }