具有单选列表的AlertDialog - 我需要一些不可点击的项目

时间:2012-01-10 15:02:04

标签: android alertdialog

我有单一选择列表的AlertDialog。 我想把一些“假”物品放在里面 - 就像下列物品的标签一样。我对常规商品和'标签'商品使用不同的布局。没关系。 我的问题是:如何使标签不可点击?

这是我的getView代码:

// @Override
public View getView(int position, View convertView, ViewGroup parent)
{
if (m_data.get(position).BaseElementType == ElementType.Divider)
{
    convertView = m_li.inflate(this.m_groupResurceID, null);
    TextView post = (TextView)convertView.findViewById(R.id.text1);
    post.setText(m_data.get(position).TypeToString());
    post.getClickable();
}
else
{
    convertView = m_li.inflate(this.m_itemResurceID, null);

    TextView post = (TextView)convertView.findViewById(R.id.text1);
    post.setText(m_data.get(position).Header);

    ImageView img = (ImageView)convertView.findViewById(R.id.image1);
    Drawable dr = m_data.get(position).TypeToIconId();
    dr.setColorFilter(BGMapsApp.IconColor, PorterDuff.Mode.SRC_ATOP);
    img.setImageDrawable(dr);
}

1 个答案:

答案 0 :(得分:0)

答案很简单! 把它放到适配器代码:

    public boolean isEnabled(int position)
    {
        //return super.isEnabled(position);
        return (m_data.get(position).BaseElementType != ElementType.Divider);
    }

现在有些项目无法点击:)

相关问题