0

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

Cheers!

hugocarlmartin
  • 719
  • 1
  • 8
  • 25
  • Here is my way: http://stackoverflow.com/questions/4549746/custom-row-in-a-listpreference/20174437#20174437 – galex Nov 24 '13 at 12:29

1 Answers1

1

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.

Ritaban
  • 763
  • 4
  • 8