Spinner下拉列表高度

时间:2014-01-29 15:21:37

标签: android spinner android-spinner

我使用自定义数组列表作为微调器。 我想将下拉窗口高度设置为100 px。我怎样才能做到这一点? 这是我的适配器:

公共类MyCustomAdapter扩展了ArrayAdapter {

    public MyCustomAdapter(Context context, int textViewResourceId,
            ArrayList<String> klinikes_spinner) {
        super(context, textViewResourceId, klinikes_spinner);
        // TODO Auto-generated constructor stub
    }

    @Override
    public View getDropDownView(int position, View convertView,
            ViewGroup parent) {
        // TODO Auto-generated method stub
        return getCustomView(position, convertView, parent);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        return getCustomView(position, convertView, parent);
    }

    public View getCustomView(int position, View convertView,
            ViewGroup parent) {
        // TODO Auto-generated method stub
        // return super.getView(position, convertView, parent);

        LayoutInflater inflater = getActivity().getLayoutInflater();
        View row = inflater.inflate(R.layout.tspinner_row, parent, false);
        TextView label = (TextView) row.findViewById(R.id.text);
        label.setText(klinikes_spinner.get(position));


        return row;
    }
}

0 个答案:

没有答案