Domanda

Is it possible to change the Listpreference row height? I managed to increase the textSize but it won't change the rowHeight.

Cheers!

È stato utile?

Soluzione

Yes it is possible . Use LayoutParams for setting the height of the particular listView item inside the getView() method of your adapter which you are binding with your ListView. Sample:

@Override
public View getView(final int position, View convertView,
        final ViewGroup parent) {

    RelativeLayout rel = null;
    if (null == convertView) {

        String inflater = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater vi;
        vi = (LayoutInflater) getContext().getSystemService(inflater);
        rel = (RelativeLayout) vi.inflate(resource, rel, true);

    } else {
        rel = (RelativeLayout) convertView;

    }
               LayoutParams params= (LayoutParams) rel.getLayoutParams();
         params.height=///some height;
                 rel.setLayoutParams(params);

         return rel;
}

Here rel is a particular row in the listView.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top